"I deeply regret my error," Pedro Sánchez told reporters.
"I am firm in my commitment to the freedom of women aged under 18. I have always publicly defended it. I apologise for the error," he tweeted on Wednesday.
His mistake quickly made him the butt of jokes on Twitter with the hashtag #PedroSanchez earning wide play.
— Lidia alvarez glez (@Lydia2300) April 16, 2015
"Pedro Sánchez must take a course on how to vote," quipped one Twitter user.
Another suggested that he had scored an "own goal".
— Adrián Bonet (@AdrianBonetLis) April 15, 2015
Sánchez's party has long supported Spanish legislation that unconditionally allows abortion for pregnancies of under 14 weeks, even among minors.
But the conservative Popular Party (PP) wants to see the law changed so that minors would only be allowed to abort with parental consent.
On Tuesday evening, after a lively showdown in parliament, lawmakers voted to reopen the debate on reforming abortion legislation.
A final vote on whether or not to reform the law is likely to be held in the coming weeks.
The Socialists accuse the government of trying to indulge more conservative elements in society, less than a year away from parliamentary elections.
In power since 2011, the PP wants to bring back an old reform draft, which would forbid abortion in most cases.
— Marcos MG (@MontarazMG) April 16, 2015