BOSTON — Massachusetts General Hospital in Boston has been named the nation’s top hospital, while Portland’s Maine Medical Center ranked No. 1 in Maine, according to U.S. News & World Report.

MGH displaced Johns Hopkins in Baltimore at the top of the list in the annual rankings released today. Hopkins had been at the top for 21 consecutive years.

Dr. David Torchiana, chairman of the Massachusetts General Physicians Organization, said the competition was not other hospitals, but “disease, health care costs, accessibility of services, and social issues.”

Maine Medical Center, meanwhile, was ranked as the top hospital in Maine. The health-care center also was recognized as “high-performing” in five specialties, including cancer, gynecology, nephrology, orthopedics and urology, according to U.S. News & World Report.

Recently, MMC ranked last in safety among four Maine hospitals by Consumer Reports and was below the national average.

In its August issue, Consumer Reports looked at six categories in its safety ratings: infections, re-admissions, communication about medication and discharge, overuse of scans that pose risks because of radiation, complications, and mortality.