The 54-year-old monarch tested positive on Wednesday morning “after experiencing mild symptoms the night before”, it said in a statement.
“His Majesty’s general state of health is good and he will keep up his institutional activities from his residence,” it said, adding he will quarantine for seven days.
The king had been due to meet with Zeljko Komsic, the Croatian member of the Bosnian presidency, in Madrid later on Wednesday.
King Felipe received his first dose of the Covid-19 vaccine in May 2021. Contacted by AFP, the royal palace did not say if he has had other doses since.
Queen Letizia and the couple’s younger daughter Sofia are not showing symptoms and will continue their activities normally.
Their elder daughter, Leonor, attends a boarding school in Wales.
Recent reports in the Spanish press have said that former King Juan Carlos, father of Felipe, recently contracted Covid while in exile in the United Arab Emirates and had to be taken to hospital in the Sheikh of Abu Dhabi’s helicopter.
Spain will on Thursday scrap a mandate to wear face masks outdoors as Covid-19 infection rates drop and hospitals report lower admissions.
The measure reverses a step taken last December amid an surge of infections fuelled by the highly contagious Omicron variant.
Masks remain mandatory in indoor public spaces, including public transportation.
So far, Spain has registered some 10.4 million cases of the virus, and 95,000 deaths.