Spanish police have arrested a man on suspicion that he planned to imitate the 1999 Columbine high-school killings in the US by planting bombs around a university campus on Mallorca.

Spain's interior minister, Jorge Fernández Díaz, hailed the arrest, saying: "It appears a massacre has been averted."

In a statement, police said they seized 140kg of bomb-making material when they arrested the 21-year-old man in Palma de Mallorca on Wednesday. They added that, in his personal diary and blog, the man – a Spaniard only identified by his initials, JMMS – talked of his admiration for the perpetrators of the Columbine attacks and how he planned to place several bombs around a campus of the University of the Balearic Islands in Palma.

The man had openly expressed his hatred for society, and particularly students, the statement said. A police spokesman said there was nothing to indicate that the man had planned to carry out the attack for any particular ideological reasons.

Twelve students and one teacher were killed in the Columbine attack in Colorado. The two perpetrators then killed themselves. The Spanish man's diary reportedly indicates that he had considered committing suicide once he had carried out the attack.

Spanish police said the man had tried several times to purchase guns, but, finding this impossible, then opted to buy explosives-making material on the internet. The statement said he had planned to make shrapnel pipe bombs.

The arrest took place just as the materials were delivered to his house, the statement said.

Police revealed they had been watching the man for the past five months after messages referring to Columbine began appearing on internet pages in Spain.

A police spokesman said the suspect had previously studied electronics at a technical training school and had recently begun a course in business administration, adding that the suspect earned money by playing poker on the internet.