The law was approved during an extraordinary cabinet meeting and it will now be put to an urgent vote in parliament, where parties in favour of Spain's monarchy have a wide majority.
It is expected to be passed with a majority as high as 90 percent although internal divisions within Spain's main opposition party, the socialist PSOE, over how it will vote on the bill could affect that result, Spanish media are reporting.
The Basque nationalist PNV party have said they will abstain while Catalonia's nationalist CiU party has yet to decide whether it will participate in the vote.
The abdication will take effect the day the new law is published in the Official State Bulletin (BOE), at an unspecified date after being passed by parliament. The new monarch can then be proclaimed immediately.
The draft law approved by Prime Minister Mariano Rajoy's cabinet included an "institutional declaration" which praised the king's role in Spain's transition to democracy following the death of longtime dictator General Francisco Franco in 1975.
"Without his drive and leadership the transition simply would not have been possible," it said.
"If Spain today is a state of law, modern and democratic, which has achieved high levels of social wellbeing and leadership in Europe and in the entire international sphere, it is due, in large measure, to Juan Carlos I's reign," the text added.
However, the draft law approved on Tuesday does not address the future legal status of the king, who is set to his legal impunity once his abdication is formalized.
After the king's announcement on Monday, thousands of anti-royalists took to the streets across Spain calling for a vote on the monarchy's survival.
The king was widely popular during most of his nearly 40-year reign, but has been dogged by scandal and health woes in the last few years.