It said the measure had been finalised in a cabinet meeting on Monday.
Foreign Minister Arancha Gonzalez Laya had previously said the requirement would be lifted in July, without giving a date.
The news comes as the UK government prepares to bring in its own 14-day quarantine policy from 8 June.
Travel firms and other industry bodies say the UK should relax the measure for visitors arriving from countries where people are at a lower risk of contracting the coronavirus.
Spain normally attracts 80 million tourists a year, with the sector providing more than 12% of the country's GDP.
Opening up the holiday market again before the summer season is over is seen as crucial to the Spanish economy.
But under the UK's new policy, any tourists returning home after taking holidays in Spain and most other foreign destinations would have to spend two weeks in self-isolation.