A 2013 measles outbreak that hit two Brooklyn neighborhoods — infecting 58 people, all of them unvaccinated against the disease — cost the city’s health department nearly $400,000, according to a new study.

Between travel, testing equipment and over 10,000 hours of work by 87 staff members, the Department of Health and Mental Hygiene was forced to spend $394,448 fighting the contagion, the Journal of the American Medical Association inquiry found.

The outbreak began in March 2013, when a single infected child returned to New York from a trip to London, wrote Dr. Jennifer B. Rosen of the city Health Department, who authored the study along with two others.