It overturned a 2004 Quebec appeals court ruling barring the kirpan, which the high court said was a blow to freedom of religion.
The decision made on Thursday affects only schools, not other places such as airliners.
The case began in 2001 when Gurbaj Multani, then 12, was suspended from school in Montreal for carrying the kirpan.
"The council of commissioners' decision prohibiting (the boy) from wearing his kirpan to school infringes his freedom of religion," the ruling said.
"Religious tolerance is a very important value of Canadian society," the ruling said.
"The interference with (his) freedom of religion is neither trivial nor insignificant, as it has deprived him of his right to attend a public school," the court said.
The League for Human Rights of B'nai Brith Canada said in a statement: "The accommodation of religious rights is intrinsic to the values of Canadian society as long as they are balanced against other fundamental rights, including the right to safety and security."
The kirpan is seen as an article
of faith for the Sikhs
Gurbaj told reporters after the ruling, "It is an article of faith. We don't use it. We don't draw it."
Ann Lowthian of the World Sikh Organisation said of the continued prohibition of the kirpan in other venues: "These matters are settled on a case-by-case basis."
The ruling also said, "If some students consider it unfair that (a Sikh) may wear his kirpan to school while they are not allowed to have knives in their possession, it is incumbent on the schools to discharge their obligation to instil in their students this value that is at the very foundation of our democracy."
"A total prohibition against wearing a kirpan to school undermines the value of this religious symbol and sends students the message that some religious practices do not merit the same protection as others.
"Lastly, the argument that the wearing of kirpans should be prohibited because the kirpan is a symbol of violence and because it sends the message that using force is necessary to assert rights and resolve conflict is not only contradicted by the evidence regarding the symbolic nature of the kirpan, but is also disrespectful to believers in the Sikh religion and does not take into account Canadian values based on multiculturalism," it added.
Orthodox Sikhs are required to carry the kirpan, one of the five artifacts of the Sikh faith, symbolising the obligation of the faithful to rise up against injustice.
It had already been allowed in schools in the provinces of Ontario, Alberta and British Columbia with certain security restrictions.
Nearly 280,000 Sikhs live in Canada, according to official statistics, and 10%-15% are orthodox.