Finnish PM Matti Vanhanen called the shooting a "great tragedy"
The gunman, reportedly identified as Pekka-Eric Auvinen, shot himself in the head and later died in hospital.
The shooting happened in Tuusula, some 50km (30 miles) north of Helsinki, and officials have set up a crisis centre to help those affected by the tragedy.
The gunman gave a warning of the attack in a video posted on the internet.
The home-made film called "Jokela High School massacre 11/7/2007" shows a young man pointing a gun and declaring himself a "social Darwinist" who would "eliminate all who I see unfit".
Correspondents say the video is similar to the one made by Cho Seung Hui, who sent a recording of himself to the US NBC television network before killing 32 students at Virginia Tech University in April.
'Great tragedy'
Announcing a national day of mourning on Thursday, Finnish Prime Minister Matti Vanhanen described Wednesday's shooting in Tuusula as a "great tragedy".
This is an awful day... The shooting has deeply undermined the sense of security in society
Matti Vanhanen
Finnish Prime Minister
In pictures: Finland shooting Finland shocked at shooting Send us your comments
"This is an awful day... The shooting has deeply undermined the sense of security in society... Nobody had expected such things," he said.
The Finnish President, Tarja Halonen, also expressed her shock.
"I send my heart-felt condolences to the families of the victims in the shooting incident," she added.
Esa Ukkllola, the head of educational and cultural services in the Tuusula region, told the BBC officials had set up a crisis centre to help those affected by the tragedy.
"There will be crisis people going to schools and discussing with teachers and students," he told Radio 5live.
"We have had lots of empathy and help from other main supporters around. They have sent us their resources like doctors, psychiatrists and psychologists so we can use them to help other schools get through this."
Gun ownership
Finnish police said five boys, two girls and the female principal of Jokela High School were shot dead when an 18-year-old pupil entered the school building around 1100 (0900 GMT). Twelve others were injured.
FINLAND GUN FACTS 5.2 million population World's third highest gun ownership 56 guns per 100 people Low rate of gun violence Guns used in 14% of homicides
The young man, named locally as Pekka-Eric Auvinen, was armed with a .22 calibre pistol, for which he obtained a licence on 19 October. The gunman did not have a criminal record and "was from an ordinary family", a police spokesman said.
The police responded to an emergency call made at 1144 (0944 GMT) and made contact with the gunman when they arrived at the school 11 minutes later, said Timo Leppala, the officer in charge of the police operation.
"Police ordered him to surrender, to which he answered by shooting towards the police," Mr Leppala said.
As police surrounded the school, students leapt to safety from windows and ran for shelter.
"Suddenly people began running and shots were heard and began raining down. I saw injured people lying in the corridor. We started to run and followed in panic. Everyone was trying to squeeze through a narrow door," Miro Lukinmaa, a student, said.
The gunman then turned his weapon on himself. He was taken to hospital with critical head wounds and later died.
Following the incident, the Finnish government met in an emergency session on Wednesday evening to consider tightening school security.
Correspondents say that although gun ownership in Finland is the third highest in the world, incidents of this kind are extremely rare in a country that prides itself on very low levels of violent crime.
Finnland begeht heute einen nationalen Tag der Trauer, nachdem am gestrigen Mittwoch ein 18-Jähriger sieben Schüler und einen Lehrer in Tuusula, 50 Kilometer nördlich der Hauptstadt Helsinki, erschossen und zwölf weitere verletzt hatte. Finnlands Ministerpräsident Matti Vanhanen beschrieb das Ereignis als „große Tragödie“. Präsidentin Tarja Halonen zeigte sich geschockt und sprach den Familien der Opfer ihr Beileid aus.

Der Attentäter, inzwischen identifiziert als Pekka-Eric Auvinen und selbst ehemaliger Schüler der Schule, war gegen Mittag in das Gebäude eingedrungen, tötete fünf Jungen, zwei Mädchen und die Schuldirektorin, bevor er seine Pistole gegen sich selbst richtete und sich in den Kopf schoss. Wenig später verstarb er im Krankenhaus.

Schon zuvor hatte der Amokläufer das Massaker im Internet angekündigt und ein Videoclip auf der Website YouTube veröffentlicht, das ihn mit einer Pistole zeigte. Er bezeichnete sich darin selbst als „sozialen Darwinisten“, der alle eliminieren werde, die ihm nicht passten. Der Film zeigte dabei Ähnlichkeiten mit dem Video, das Cho Seung Hui an den US-Fernsehsender NBC schickte, bevor er im April dieses Jahres 32 Studenten an der Virginia Highschool tötete.

Finnland, mit seinen nur 5,2 Millionen Einwohnern, hat die weltweit dritthöchste Dichte von Schusswaffen pro Einwohner. Auf 100 Menschen kommen 56 Schusswaffen.