The nurse is said to be the first person in the current outbreak known to have contracted Ebola outside Africa.
Health Minister Ana Mato said the woman was part of the team that treated Spanish priest Manuel Garcia Viejo, who died of the virus on September 25.
Some 3,400 people have died in the outbreak – mostly in West Africa.
The nurse is in a stable condition, Reuters quoted health officials as saying. She started to feel ill last week when she was on holiday.
She was admitted to hospital in Alcorcon, near Madrid, on Monday morning with a high fever, Ana Mato said.
Doctors isolated the emergency treatment room.
The infection was confirmed by two tests, the minister said.
Manuel Garcia Viejo died in the hospital Carlos III de Madrid after catching Ebola in Sierra Leone.
Another Spanish priest, Miguel Pajares, died in August after contracting the virus in Liberia.
Ebola spreads through contact with the bodily fluids of someone who has the virus and the only way to stop an outbreak is to isolate those who are infected.
There have been nearly 7,500 confirmed infections worldwide, with officials saying the figure is likely to be much higher in reality.
Guinea, Sierra Leone and Liberia have been hardest hit.
Celebrations in West Africa for the Muslim festival of Eid al-Adha are being badly affected by the Ebola outbreak, with many public places deserted this weekend.
Earlier, US health officials said passengers arriving in the US from Ebola-affected countries in West Africa could be subject to extra screening at airports.
But the White House said on Monday it was not considering a ban on passengers from such countries, according to Reuters news agency.
It comes as the US tries to limit the spread from its first confirmed case, a Liberian national, Thomas Eric Duncan, in Dallas.
8lnqsA4VHmoImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…