Its population fell by 22,000 people to 21.707 million last year, the first decline recorded in 17 years, the municipal statistics bureau said.
Natural population growth – the number of births versus deaths – has also slowed in Beijing.
Shanghai caps population at 25 million by 2035 but experts doubt plan will work
In 2015, Shanghai recorded its first population decline since 2000, mostly because of migrant workers leaving the city.
People living in the city but whose permanent residency, or hukou, was in places outside Shanghai totalled 9.8 million in 2015 – a drop of nearly 150,000 from 2014.