A whacky film full of surprises beat 18 other films competing for the 70th anniversary Golden Palm award.
The Square is the story of Christian, played by Danish actor Claes Bang as a modern art curator.
The action revolves around conceptual art work in the form of a square painted in white-lines in the middle of the city. This conceptual square is aimed at raising awareness about individual responsability for the wider community. Director Ostlund says The Square actually exists in several Scandinvian cities.
Ostlund is becoming a familiar face at Cannes. The Square is his third film at the Festival.
After receiving the award Ostlund said "there'd been a lot of buzz about the film this week, so I thought we might win a prize, get the director's award or something, but not not the Golden Palm. It's a great ending for the hard work we've done along with Claes... I hope many people will see the film."
Othe prizes went to the much-touted 120 Beats per Minute by Robin Campillo about NGOs' struggle to put AIDS on political agendas, which won the Grand Prix. Campillo said the prize is a tribute "not only to those who died, but to the survivors."
The Jury prize went to Russian Andrey Zvyagintsev's Loveless, about the disappearance of a small boy traumatised by his parents' aggressive separation.
Lynne Ramsay's You Were Never Really Here won best actor for Joaquim Phoenix and shared the Best scenario award with Yorgos Lanthimos for his The Killing of a Sacred Deer which he co-wrote with Efthymis Filippou.
Sofia Coppola won Best director for her womens'-eye view of The Beguiled, set in the American Civil War, and Diane Kruger won best actress for her outstanding leading role as the widow, in Fatih Akin's In the Fade, about the consequences of a racist murder in Germany.
49 year-old Nicole Kidman who acted in three films in the different festival sections including the two prize-winning films,The Beguiled and The Killing of a Sacred Deer, was awarded a Cannes special 70th anniversary prize.
The jury's job is never an easy one, but they have to reach a consensus. The role of the chair, this year occupied by Spanish director Pedro Almodovar, is decisive. Almodovar who champions LGBT causes almost broke down just after the award ceremony at a press conference when he talked about 120 Beats Per Minute, describing the characters in the film as "heros". After the awards ceremony, Jury member and US actor Will Smith made no bones about rooting alone for Jupiter's Moon by Kornel Mundruzco, showing the awards are as impartial as possible.