Hollywood stepped out of its comfort zone Sunday, awarding the best picture Oscar to the harrowing “12 Years a Slave.”

In the days leading up to the ceremony at the Dolby Theatre in Los Angeles, it was reported that some Oscar voters could not bring themselves to watch the film, which vividly dramatized the horror of families torn apart, daily humiliation and savage punishment.

Oddsmakers had predicted a narrow win for the virtuosic sci-fi blockbuster “Gravity” as the result of the academy’s preferential voting system, which can deliver a win to a film with a broad consensus of first- and second-place votes. The two films made history by tying in the crucial Producers Guild of America race.

Nevertheless, the heartbreaking historical drama triumphed over “Gravity,” the well-liked con caper “American Hustle” and six other rivals. Director Steve McQueen, accepting the award, said “everyone deserves not just to survive but to really live.” He dedicated the win “to all people who have endured slavery and the 21 million still suffering in slavery.”

“Slave” also received Oscars for best supporting actress Lupita Nyong’o, and John Ridley’s screenplay adaptation of Solomon Northup’s memoir of captivity.

“Gravity” won seven Oscars, including two for Mexican director Alfonso Cuarón, a six-time nominee, who accepted in English and his native Spanish. He shared his first Oscar of the evening with Mark Sanger for their editing work, including the sinuous opening shot, a quarter-hour of zero-gravity wizardry that set a new standard for visual storytelling. The space epic virtually swept the technical categories, ceding only production design to Baz Luhrman’s Art Deco extravaganza “The Great Gatsby.”

Odds-on favorite Matthew McConaughey won best actor for his transformative role as real-life AIDS activist Ron Woodroof in “Dallas Buyers Club.” His serious yet engaging performance capped a two-year career renaissance that remade him from matinee idol to powerhouse actor. His chances were probably boosted by his current role as a nihilist cop in the cable hit “True Detective,” another reminder of his remarkable range. He thanked God for presenting him with opportunities “that I know are not of any human hand.”

As expected, “Dallas Buyers Club” co-star Jared Leto took best supporting actor over Barkhad Abdi, the Somali refugee turned Minneapolis limo driver who scored a nomination for his acting debut as a surprisingly sympathetic pirate in “Captain Phillips.”

“He's from Somalia, he's a sommelier,” joked Oscar host Ellen DeGeneres as she opened the ceremony. “Who’s the wine captain now?”

A 50-to-1 long shot, Abdi was paid $65,000 for the role two years ago, according to a New Yorker report, and has been subsisting on a per diem allowance from Sony Pictures during awards season — plus occasional rides from a Minneapolis friend who’s now a cabbie in Los Angeles. He savored the moment as he looks for a followup role — possibly as South African marathoner Willie Mtolo —and plans a permanent move to L.A.

“I just want to remember all the people who helped me,” Abdi told an ABC-TV interviewer on the red carpet. “It’s an amazing family.”

McConaughey and Leto became the fifth set of male performers to win best actor and best supporting actor for the same film. Bone-slender and costumed in wigs and thigh-high skirts, Leto was almost unrecognizable as a transgender woman in “Dallas Buyers Club.” The film’s makeup and hairstyling team, Adruitha Lee and Robin Mathews, were also recognized with an Oscar.

It was another winning night for the much-awarded Cate Blanchett, after wins from SAG, the Critics Choice and the Golden Globes for her turn as a fallen socialite in Woody Allen’s “Blue Jasmine.” A whiff of scandal surrounded this year’s race, amid concerns that Blanchett’s chances could be tarnished by revived child abuse allegations against her director Woody Allen. In the end, the controversy didn’t deny Blanchett her second Oscar.

“As random and subjective as this award is, it means a great deal,” she said. She decried the film industry notion that “female films with women at the center are niche. They are not. They make money!”

The supporting actress prize often honors new talent, and Lupita Nyong’o’s role as abused field worker Patsey in “12 Years a Slave” had many viewers convinced the award was hers to lose. She faced strong competition from last year’s best actress, Jennifer Lawrence, whose performance as a con man’s loose cannon wife in “American Hustle” reached heights of lunatic comedy.

In the end, gravitas trumped giggles, and Nyong’o received the first standing ovation of the night. “I want to salute the spirit of Patsey for her guidance,” she said. “Thank you so much for putting me in this position,” she added, brushing aside tears. “It has been the thrill of my life.”

Already a box-office smash, Disney’s jubilant return to animated musicals “Frozen” was named best animated film. The prize was a Cinderella moment for co-director Jennifer Lee, the first woman to helm a Disney animated feature, who built her story around complex female characters.

Director Spike Jonze earned his first nomination and first win, for the screenplay of “Her,” an emotionally astute exploration of computer technology’s effect on love and relationships.

Five-time nominee Emmanuel Lubezki earned his first statuette for his rigorously realistic cinematography on “Gravity,” which seamlessly stitched together live actors, meticulously crafted sets and countless computer-generated effects. The film also won for best visual effects. Any other result would have been the upset of the night.