In a stunning upset, the nine-member jury led by Spanish director Pedro Almodovar and including Hollywood stars Jessica Chastain and Will Smith awarded the trophy to the movie's director, Ruben Östlund.
"Oh my God, oh my God!" Östlund shouted from the stage after besting a raft of favourites for one of global cinema's most coveted honours.
In a 70th anniversary edition marked by raging debate over sexism in the movie industry, Sofia Coppola became only the second woman in history to win best director for her battle-of-the-sexes thriller "The Beguiled" with Nicole Kidman and Colin Farrell.
Kidman, who appeared in four different projects at the festival, accepted a special 70th anniversary award from the jury.
Diane Kruger clinched best actress for her first film role in her native German as a devastated mother who has lost her family in a Hamburg terror attack, in Fatih Akin's "In the Fade".
"I cannot accept this award without thinking of everyone who has been touched by an act of terrorism... you have not been forgotten," the clearly moved actress said.
Three-time Oscar nominee Joaquin Phoenix nabbed best actor for his turn as a hammer-wielding hitman in the ultraviolent thriller "You Were Never Really Here".
"Any work that I did was linked to the work of Lynne Ramsay," the film's British director, Phoenix said, before apologising for his tuxedo-and-trainers look at the gala ceremony.
"I don't wear leather," the committed vegetarian explained.
Greece's Yorgos Lantimos shared the best screenplay award with Ramsay for "The Killing of a Sacred Deer", an icy thriller set in a wealthy American suburb and starring Kidman and Farrell.
The runner-up Grand Prix went to moving French drama "120 Beats Per Minute" about the radical activists who helped shame the world into action on AIDS.
"This film is an homage to those who died but also those who survived and are still alive, who had so much courage," said the movie's director, former ACT UP member Robin Campillo.
Campillo also wrote the screenplay for "The Class", a drama about a multicultural Paris high school that scooped the Palme d'Or in 2008 as well as an Oscar nomination.
"Loveless" by Andrey Zvyagintsev, a wrenching drama about moral rot eating away at Russian society under Vladimir Putin, took the third place jury prize.
"The Square", coming in at two hours and 20 minutes, is an often hilarious art world satire exploring creative liberty, free speech and the blurred lines between the sexes.
Danish actor Claes Bang plays a museum director and divorced father of two young daughters who finds himself in an increasingly absurd set of predicaments.
The movie features Elisabeth Moss ("Mad Men") and Dominic West ("The Wire") in small roles viciously lampooning the self-important art world.
One set-piece featuring a wild, bare-chested man performing as an ape wreaking havoc at a posh gala dinner entered festival legend.
Cannes' 12 days of screenings and celebrity-packed soirees -- which were somewhat muted by the Manchester bombing -- were marked by unprecedented anti-terror measures and a raging row over how technology is shaping the future of the movie industry.
Netflix had two movies in competition for the first time but faced blowback from critics who argue that online streaming is destroying cinema distribution and with it the magic of the big-screen experience.