The 17-year-old approached Mariano Rajoy, while the Prime Minister was on walkabout in his native Galicia, and after asking him to pose for a ‘selfie' delivered a powerful punch to the side of his face.
The boy named locally as Andrés de V. F. is the privately educated son of a lawyer from Pontevedra in Galicia, the northwestern region of Spain, who has used social media to express disaffection with the conservative Popular Party.
The teenager, whose mother is a cousin of the wife of the Prime Minister according to local newspaper La Voz de Galicia, was arrested moments after the attack when he was wrestled to the ground by Rajoy's protection agents.
But far from feel ashamed for being led away in handcuffs, the teenage rebel gave a thumbs up sign to cameras and shouted "I'm happy I did that".
Some onlookers were heard to shout "bravo, bravo" after the incident.
According to his twitter profile, Andres was a member of Mocidade Granate, a radical fan club attached to the Pontevedra football team, which while known for hooliganism, is not considered excessively violent, according to El Pais.
The boy had reportedly been a student at La Sauces, an exclusive private school considered one of the best in the region, and had been expelled several times from different schools in the region.
Sources close to the family told La Voz de Galicia that the boy had shown troubled behaviour and had recently been treated for depression.
His Twitter feed revealed that the teenager had repeatedly posted negative comments about the conservative party leadership and had a year ago threatened to carry out an attack on the Popular Party headquarters in Pontevedra.
He also describes himself as 'anti-fascist' and supports a group calling for independence for the region of Galicia.
After spending a night in jail, the teenage will be assessed by a psychiatrist and called before a Juvenille Court.
The attack happened when the 60-year-old conservative Spanish leader was walking through the city of Pontevedra on the latest stop of his push for re-election on Sunday.
A video of the incident shows the youth, wearing a black jacket and sporting a crew cut, punching the prime minister hard on the left side of his face before being wrestled to the ground.
A photo posted after the incident picture Rajoy without his glasses, red marks on the left of his face and neck.
Rajoy on Thursday described the moment of the attack.
"It never happened to me before and it was over very quickly," he told Ana Rosa during an interiew on Telecinco on Thursday morning. "The only problem was that my glasses fell off and I could not find them, but then normal life resumed.".
He also said that he had been left with a swollen cheek but that put some anti-inflammatory cream on it and was now "fine".
To prove his point, the Prime Minister posted a clip of him exercising on Thursday morning at a gym in Barcelona.
The incident comes at an eventful time for the electoral campaign, marked by a debate of rare ferocity on Monday, which saw the usually calm Rajoy slam his main rival Pedro Sanchez of the opposition Socialists as "a miserable wretch" when he questioned his integrity.
Sanchez wanted to know why the premier had not resigned over corruption allegations that have swirled since he took office in 2011.
The attack served to unite the party leaders in condemnation with all three of the party leaders running against Rajoy tweeting messages.
"I am utterly replused by the attack on Mariano Rajoy in Pontevedra," tweeted Podemos leader Pablo Iglesias.
Mi más absoluta repulsa a la agresión a @marianorajoy en Pontevedra— Pablo Iglesias (@Pablo_Iglesias_) December 16, 2015
"All our solidarity and socialist affection goes to Rajoy and the PP family. Violence has no place in democracy," said the PSOE leader.
Todo la solidaridad y el cariño socialista a Rajoy y a la familia del PP. La violencia no cabe en democracia. #PedroSánchezenlaSER.— Pedro Sánchez (@sanchezcastejon) December 17, 2015
While Albert Rivera of Ciudadanos said: "There are people justifying this attack on Rajoy. Violence and its justification is intolerable. We need respect and coexistence, not hate and factions."
Hay gente justificando agresión a Rajoy. Es intolerable la violencia y su justificación.Necesitamos respeto y convivencia,ni odio ni bandos.— Albert Rivera (@Albert_Rivera) December 16, 2015