Also nominated for best picture were the Truman Capote story "Capote"; the ensemble drama "Crash"; the Edward R. Murrow chronicle "Good Night, and Good Luck"; and the assassination thriller "Munich."
The Johnny Cash biography "Walk the Line," considered a likely best-picture nominee, was left out of that category, though Joaquin Phoenix and Reese Witherspoon earned acting nominations.
Three films were tied with six nominations each -- "Crash," "Good Night, and Good Luck" and "Memoirs of a Geisha," though "Geisha" was shut out in the top categories.
"Munich," which had fallen off many awards analysts' best-picture picks after a lukewarm reception, scored well with five nominations, including director for Steven Spielberg.
"King Kong," directed by "Lord of the Rings" creator Peter Jackson, earned only technical nominations, losing out in the major categories.
George Clooney picked up three nominations: as supporting actor for his role as a steadfast CIA undercover agent in "Syriana" and best director and co-writer for "Good Night."
It was the first time ever that a contender was honored with acting and directing nominations for two different movies.
Along with best-actor contender Ledger, and directing nominee Lee, "Brokeback Mountain" scored nominations for Michelle Williams as supporting actress, Jake Gyllenhaal as supporting actor and Larry McMurtry and Diana Ossana for their screenplay adaptation of Annie Proulx's short story.
Director Lee said he was gratified at the reception both homosexual and heterosexual audiences have given "Brokeback Mountain," which has proven a steady box-office draw across the country.
"I didn't know there were so many gay people out there. Everywhere, they turn up," Lee said. "More importantly, I think I'm amazed how people everywhere have had the sensitivity to want to get into the complexity of the issue, the probability of love, the illusion of love, all those things. It's not simple things you can categorize as right or wrong."
The acting categories were a mix of familiar Oscar faces such as past winners Judi Dench and Charlize Theron, veterans like Clooney, Witherspoon, Rachel Weisz, David Strathairn and Felicity Huffman gaining their first academy attention, and young performers such as Williams and Amy Adams as a big-hearted Southern waif in "Junebug."
Philip Seymour Hoffman, the best-actor favorite for his remarkable embodiment of Capote, joined Ledger in the best-actor category. Hoffman has triumphed at earlier film honors, including the Golden Globes.
Along with Hoffman, Ledger and Phoenix, the other nominees were Terrence Howard as a small-time hood turned rap singer in "Hustle & Flow" and Strathairn as newsman Murrow in "Good Night, and Good Luck."
The best-actress race presumably will shape up as a two-woman contest between Huffman in a gender-bending role as a man about to undergo sex-change surgery in "Transamerica" and Witherspoon as singer June Carter, Cash's musical companion and future wife, in "Walk the Line."
Huffman won the Golden Globe for best dramatic actress, while Witherspoon earned the Globe for best actress in a musical or comedy. Witherspoon beat Huffman on Sunday for the best-actress prize at the Screen Actors Guild Awards.
Also nominated for the best-actress Oscar: Dench as a society dame who starts a nude stage revue in 1930s London in "Mrs. Henderson Presents"; Keira Knightley as the romantic heroine of the Jane Austen adaptation "Pride & Prejudice"; Charlize Theron as a mine worker who leads a sexual-harassment lawsuit against male co-workers in "North Country."
"I am so thrilled to be nominated for something I loved working on every single day," Dench said.
"Brokeback Mountain" led a wave of independent films that scored big in the nominations, instead of the studio fare that normally dominates the Oscars. Other than "Munich," most bigger budget movies that had been on the best-picture radar, such as "Walk the Line," "Memoirs of a Geisha" and "Cinderella Man," were overlooked in the top Oscar category.
The year's biggest hit, "Star Wars: Episode III -- Revenge of the Sith," earned only one nomination (for makeup) but was shut out otherwise -- including the visual- of the film in scene-stealing role.
Lee, who won the Directors Guild of America honor Saturday for "Brokeback Mountain," is the clear favorite to win the best-director Oscar.
Along with him, Spielberg and Clooney, other directing nominees were Paul Haggis for "Crash" and Bennett Miller for "Capote."
It was the first time since 1981 that the same five movies were nominated for directing and best picture.
And for the first time since the animated feature film category was added in 2001 that no nominees were made using computer-generated imagery. The nominees: the hand-drawn "Howl's Moving Castle," and the stop-motion films "Tim Burton's Corpse Bride" and "Wallace & Gromit in The Curse of the Were-Rabbit."
"Wallace & Gromit" creator Nick Park said he was thrilled by the nomination.
"It's fantastic," Park said, toasting the nomination with champagne at Heathrow Airport as he waited for a flight to Los Angeles. "You never know with these things. It's so unpredictable.
"You make the film for its own sake really. You don't make the film for this reason. It's just a great bonus."
Oscar nominees in most categories are chosen by specific branches of the Academy of Motion Picture Arts and Sciences, such as directors, actors and writers. The full academy membership of about 5,800 is eligible to vote in all categories for the Oscars themselves.
ABC will broadcast the Oscars live from Hollywood's Kodak Theatre, with Jon Stewart as host.