"The Square" is the first Swedish film to win the coveted prize in 66 years. Ostlund, whose breakout feature, "Force Majeure", garnered the Un Certain Regard Jury Prize here in 2014, is only the second Swedish director after Alf Sjoberg to win the Palme d'Or.
Sjoberg won in 1951 for a screen adaptation of the August Strindberg play "Miss Julie".
The 2017 Palme d'Or was announced by Spanish filmmaker and jury president Pedro Almodovar and presented to Ostlund, a Cannes Competition first-timer, by French actress Juliette Binoche at a glittering closing ceremony in the festival's main screening venue Grand Theatre Lumiere.
The Grand Prix, the prize for the second best film in a 19-film Competition lineup, went to French director Robin Campillo's 120 "Battements Par Minute" (BPM - Beats Per Minute), a perceptive and affecting drama about Parisian AIDS activists of the early 1990s.
More From This Section
The Moroccan-born Campillo was co-screenwriter of the 2008 Palme d'Or winner, "The Class", directed by Laurent Cantet.
Sofia Coppola bagged the Best Director Prize for "The Beguiled", a feminist retelling of the 1971 Clint Eastwood starrer about a wounded Union soldier forced to take refuge in an all-girls seminary in Virginia during the Civil War.
This was in a way a repeat of the fate that Zvyagintsev's "Leviathan" met in 2014, when it lost out to Nuri Bilge Ceylan's "Winter Sleep" and had to be content with the Best Screenplay award.
This year's Best Screenplay nod was received jointly by the writers of "The Killing of a Sacred Deer" (Yorgos Lanthimos and Efthimis Fillipou) and "You Were Never Really Here" (Lynne Ramsay).
Notably, both of Kidman's Competition entries (The Beguiled and The Killing of a Sacred Deer) figured on the awards roster drawn up Almodovar's nine-member jury made up of three other feted directors - Paolo Sorrentino, Park Chan-wook and Maren Ade - besides actors Will Smith, Jessica Chastain, Fan Bingbing and Agnes Jaoui and music composer Gabriel Yared.
German-American Diane Kruger won the best actress prize for her nuanced performance as a Hamburg woman who loses her Turkish husband and six-year-old son in a bomb blast triggered by neo-Nazis in Fatih Akin's "In the Fade".
The Camera d'Or prize went to Leonor Serraille's free- flowing character-driven "Jeune Femme" (Montparnasse Bienvenue), which played in Un Certain Regard.