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 25 September.
Some 3,400 people have died in the outbreak – mostly in West Africa.
The Spanish nurse is in a stable condition, Reuters quoted health officials as saying. She started to feel ill last week when she was on holiday.
The nurse was admitted to hospital in Alcorcon, near Madrid, on Monday morning with a high fever, Ms 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 health officials said people 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 travellers 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 in Dallas.
Thomas Duncan’s condition is critical but stable, Reuters quoted doctors in the state of Texas as saying on Monday.
BBC.