The boys, 16 and 17, were arrested in Stockholm after police received information that they were planning murder, Karin Solberg, a police spokeswoman said. One of them was also suspected of making threats.
Rolf Oden, principal at the Enskede Gards Gymnasium, a secondary school in suburban Stockholm said: "There is a threat against me which ... has been directed toward me personally, but I don't want to get into it any more than that. These two boys are clearly inspired by the events in Finland."
In Finland, meanwhile, hundreds of children panicked yesterday after an online threat claimed their school would be the next target.
On Wednesday, 18-year-old Pekka-Eric Auvinen killed six pupils, the school's headteacher and its nurse in the town of Tuusula after posting a video on YouTube.
Yesterday's hoax, directed at a school in Kirkkonumm, about 45 miles from Tuusula, came as Finland's government said it was planning to increase the age at which unsupervised gun use is allowed to 18.
Maarit Rossi, the principal of Kirkkoharju school in Kirkkonummi, said: "There was a threat on the internet.
"Someone posted a note with the username Sturmgeist, saying that the next target would be a Kirkkonummi Middle School.
"One can imagine how the rumours spread when we have 1,300 pupils in the complex. There was panic."
"Sturmgeist89", meaning "Stormspirit" in German, was the YouTube username of the Tuusula killer.
Pupils were allowed to leave the school with parental permission and regular classes were suspended. Police said they regarded the threats aimed at Kirkkonummi as "a bad joke".
Finland has resisted European Union plans to limit gun ownership to those 18 years or older, since Finns as young as 15 have had the right to own and use a gun alone.
But yesterday the government signalled a change in policy as a result of the Tuusula shooting.