Spanish Prime Minister Mariano Rahoy has said 76-year-old King Juan Carlos is to abdicate and his son Crown Prince Felipe will take over the throne.
"His Majesty King Juan Carlos has just informed me of his desire to renounce the throne and begin the process of succession," Mr Rajoy said.
The king's abdication brings an end to a 39-year reign that ushered in democracy but ended in a string of scandals.
King Juan Carlos helped smooth Spain's transition to democracy in the 1970s after the Francisco Franco dictatorship.
However, he has lost public support in recent years due to corruption scandals and gaffes.
His daughter Princess Cristina and her husband Inaki Urdangarin are under investigation in a corruption case.
The king, whose health is failing and has had a number of hip operations in recent years, is stepping down for personal reasons, Mr Rajoy said.
Spain does not have a precise law regulating abdication and succession.
Mr Rajoy said his cabinet would meet very soon to set out the steps for Prince Felipe to take over as Felipe VI.
Prince Felipe, 46, has had an increasingly important role in ceremonial events in the past year and has not been implicated in the corruption case involving his sister and her husband.
Juan Carlos was once beloved for his common touch and was seen as much more accessible than the British royals.
In 2012, at the height of Spain's financial crisis, the king fell and broke his hip during an elephant-hunting trip in Botswana.
The lavish privately-funded safari was a secret until his accident and came at a time of particularly harsh public spending cuts.
62% of Spaniards were in favour of the king stepping down, according to a January poll by Sigma Dos.
That compared with 45% a year earlier.
Only 41% of those polled had a good or very good opinion of the king.
Prince Felipe has a positive rating of 66% and most Spaniards believe the monarchy could recover its prestige if he took the throne, according to the poll.
Prince Felipe married divorced journalist Leticia Ortiz in 2004 and they have two daughters.