In the end, Oscar voters couldn't truly avert their gaze from "12 Years a Slave."

Even though many Oscar voters found filmmaker Steve McQueen's searing chronicle of enslavement almost too harrowing to watch, "12 Years a Slave" prevailed Sunday to win the best picture trophy in one of the closest contests in modern Academy Awards history.

In a ceremony in which the space thriller "Gravity" collected a leading seven statuettes — including the first directing Oscar won by a Mexican-born filmmaker — the biggest honor went to the true-life account of the kidnapping and auctioning of Solomon Northup, a New York freeman bartered as a Louisiana cotton picker.

"Everyone deserves not just to survive but to live," the British director McQueen said in accepting the best picture award at the Dolby Theatre in Hollywood. "This is the most important legacy of Solomon Northup. I dedicate this award to all the people who have endured slavery."

Owing to its unflinching representation of whippings, rape and lynchings, "12 Years a Slave" was not intended to be easy viewing. But it was continually buoyed by tremendous critical acclaim, and throughout the seemingly endless awards season it maintained momentum even when facing filmmaker Alfonso Cuarón's blockbuster "Gravity" and writer-director David O. Russell's popular con game tale "American Hustle."

McQueen became the first black director to make a best picture winnner, and "12 Years a Slave" was one of several movies last year that explored the often traumatic history of African Americans, a slate that included "42," "Fruitvale Station" and "Lee Daniels' The Butler."

The subject matter of "12 Years a Slave" sparked several thorny jokes within Hollywood, with host Ellen Degeneres opening the show at the Dolby Theatre by saying, "So many different possibilities. Possibility No. 1: '12 Years A Slave' wins best picture. Possibility No. 2: You're all racists."

Members of the Academy of Motion Picture Arts and Sciences ultimately split their ballots among many films, but the Solomonic vote-splitting left "American Hustle," which entered the evening tied with "Gravity" for the most nominations with 10, without a single statuette.

Proving that "Blue Jasmine" was not a referendum on the personal life of writer-director Woody Allen, Cate Blanchett was named lead actress for her depiction of a society wife whose life is imploding. "I'm here accepting an award in an extraordinary screenplay by Woody Allen. Thank you so much, Woody, for casting me. I truly appreciate it," Blanchett said.

"Every day, every week, every month and every year of my life my hero is always 10 years away," McConaughey said of how he keeps chasing himself. "I'm never going to be my hero … that's just fine with me because that keeps me with somebody to keep on chasing."

And while they handed "12 Years a Slave" the best picture prize, Oscar voters were parsimonious with the rest of their praise. In winning just two other Oscars — it was the recipient of the supporting actress and adapted screenplay statuettes — "12 Years a Slave" matched 2005's "Crash" for taking the best picture honor with only three total wins.

For Degeneres' banter and stunts — serving pizza to Brad Pitt, posing for a selfie with Meryl Streep and Bradley Cooper — the evening was punctuated by several unusually emotional and personal acceptance speeches, including remarks from "12 Years a Slave" supporting actress Lupita Nyong'o, "Dallas Buyers Club" supporting actor Jared Leto and the songwriters of "Let it Go" from "Frozen."

Lupita Nyong'o, the Kenyan actor who made her feature film debut in "12 Years a Slave" as the much-abused slave Patsey, delivered one of the evening's most emotional acceptance speeches, recognizing that her honor was based on the actual suffering her real-life character endured some 170 years ago. "It doesn't escape me for one moment that so much joy in my life is thanks to so much pain in someone else's," Nyong'o said.

John Ridley, who adapted Northup's 19th century memoir of the same name for "12 Years a Slave," similarly bestowed his thanks on the man sold into slavery who memorialized his tale soon after his emancipation. "All the praise goes to Solomon Northup," Ridley said in his adapted screenplay acceptance speech. "Those are his words, that is his life."

For all of its acclaim, "12 Years a Slave" has done solid but not stunning business. It actually has performed better overseas than it has in domestic theater — grossing nerly $90 million internationally and $50 million in North America.

In the opening award presented in the evening, actor-musician Leto, who hadn't performed in a film for five years before "Dallas Buyers Club," won the supporting actor Oscar for his depiction of the transgender AIDS patient Rayon. He movingly thanked his mother, who was in attendance — "She encouraged her kids to be creative, to work hard and to do something special" — and dedicated his triumph to "the 36 million people who have lost the battle to AIDS."

The film, which was 20 years in the making, also won the statuette for makeup and hairstyling, in large part for the work in transforming Leto into Rayon and covering McConaughey in a rash — all on a shoestring makeup budget of just $500.

Cuarón, the first Mexican filmmaker to win the directing Oscar, also shared in "Gravity's" editing win. "For many of us involved in this film, it was definitely a transformative experience," Cuarón said of the production, which took more than four years to conceive, film and complete. "And it's good, because it took so long then if not, it would be a waste of time."

"Gravity" won in the very first category in which it was nominated, for visual effects. "It seemed like a crazy idea," visual effects supervisor Tim Webber said in accepting the Oscar for the space thriller.

Cuaron's film, by far the most successful of the best picture nominees with more than $700 million in global ticket sales, then took the next four prizes for which it was eligible: sound mixing, sound effects editing, cinematography for Emmanuel Lubezki, and editing. It lost out in production design to "The Great Gatsby," but then it bounced right back by winning for score.

"Frozen," one of the most successful animated films of all time with a worldwide box-office gross of more than $1 billion, was named best animated feature and also collected the best song Oscar for its "Let it Go." Italy's "The Great Beauty" won the foreign language Oscar.

Catherine Martin, the wife of and longtime collaborator with director Baz Luhrmann, took the costume design trophy for Luhrmann's "The Great Gatsby," and Martin also shared in its win for production design. Spike Jonze, the writer and director of "Her," took the original screenplay Academy Award.

"The Lady in Number 6: Music Saved My Life" was selected as top documentary short. The film follows Alice Herz-Sommer, the pianist and oldest known Holocaust survivor who was 109 years old when the movie was made. She died last week ago at 110. "Mr. Hublot" won for animated short, while "Helium" was honored as the top live action short.

The crowd-pleasing "20 Feet From Stardom" won documentary feature. Darlene Love, one of the vocalists in the movie about backup singers, gave the ceremony one of its only spontaneous moments when she came onstage to collect the award and sang an a cappella verse from "His Eye is on the Sparrow." As usual, she brought down the house.

But the evening's last words were said backstage by Pitt, one of the producers of "12 Years a Slave."

"It's important because it deals with our history," the actor said of his best picture win. "It's important that we understand our history not for any kind of guilt, but with an understanding of who we were so we can better understand who we are now. And, most importantly, so we can understand who we're going to be."