Health Minister Ana Mato said the woman was part of a team that treated Spanish priest Manuel Garcia Viejo, who died of the virus on September 25.
The infection was confirmed by two tests, the minister said.
The nurse is the first person in the current outbreak known to have contracted Ebola outside Africa.
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.
Doctors have isolated the emergency treatment room.
She is reportedly in a stable condition.
Some 3,400 people have died in the outbreak - mostly in West Africa.
Manuel Garcia Viejo died in the hospital Carlos III de Madrid after catching Ebola in Sierra Leone.
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.
Sierra Leone has recorded a record 121 deaths from Ebola and scores of new infections in one of the single deadliest days since the disease appeared in the West African country more than four months ago, according to recent government health statistics.
The figures, which covered the period through Saturday, put the total number of deaths at 678.