The nation’s largest city is losing population for the first time in more than a decade, new federal estimates show.

International migration into New York City’s five boroughs tapered off, as more residents left, shrinking the city’s population in 2017 and 2018, according to U.S. Census Bureau numbers released Thursday.

New York’s population...