The prime minister, 60, was unhurt, a People's Party spokesperson said, but Rajoy appeared later with a deep red mark on his face.
Spain holds three suspected Islamic State recruiters
A young man punched Rajoy hard on the side of his head, knocking his glasses off, as he walked through the town of Pontevedra. The young man, a minor, was subsequently arrested, police confirmed separately.
https://twitter.com/javisri55/status/677224999913201664
Rajoy sent a message on Twitter, thanking his supporters and reassuring the public.
"I'm fine, and on the way to a rally in Coruna," he said.
The aggressor had been standing next to Rajoy when he suddenly struck out, catching the premier by surprise.
Rival candidates also sent messages of support via text, the Ciudadanos party said.
Spain arrests suspected extremist about to head to Syria
Rajoy's ruling People's Party is expected to win the election, even though it has presided over one of the worst economic slumps in decades. But it may short of the parliamentary majority it has enjoyed since 2011.
Spain has one of the highest youth unemployment rates in the European Union, with almost half of all job-seekers under 25 unable to find work.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ