Along with almost half a million legal and irregular immigrants, an additional 39,166 Spanish citizens returned to the country between January and June. Over the same period, 166,318 people left Spain.
This means that overall, the net migration to Spain - the difference between immigrants and emigrants - was 121,564 people.
This more than made up for the declining birthrate in the country; the difference between the number of registered births and deaths was just 46,273 people, according to INE.
The overall population thus increased by 74,591 people to a total of 46,733,038 inhabitants.
Two minors rescued at sea
Over the weekend, Spanish coast guards said they rescued two underage migrants who were attempting to cross the Strait of Gibraltar aboard a truck tire. The two are believed to have left from Morocco.
Authorities did not provide information on their gender or nationality. The Strait of Gibraltar is 14-kilometer-wide stretch of ocean.
Spain has registered the landing of some 57,000 migrants since the start of 2018, according to data provided by the United Nations, including at least 11,000 unaccompanied minors. At least 750 people died at sea while attempting to reach Spain.