Moonlight has won best picture at the Oscars - but only after Faye Dunaway initially said La La Land had won.
Beatty said that "Emma Stone, La La Land" was written in the envelope, which is why the error was made.
The team from La La Land were in the middle of their acceptance speeches when the mistake was discovered.
Musical La La Land won six Oscars including best director and best actress. Moonlight also won adapted screenplay and best supporting actor.
Damien Chazelle, director of La La Land, became the youngest filmmaker to win a best director Oscar at the age of 32.
Bonnie and Clyde stars Beatty and Dunaway announced La La Land had taken the best picture prize - but then the musical's producer Jordan Horowitz announced there had been a mistake.
He said: "This is not a joke. Moonlight is best picture," and showed the camera the card that revealed the winner.
Two La La Land producers had already given their acceptance speeches before the mistake was revealed.
Host Jimmy Kimmel joked that he knew he would he would mess up compering the ceremony, and added: "Personally I blame Steve Harvey for this," referring to Harvey's mistake in announcing the Miss Universe winner in 2015.'In my dreams'
Beatty had opened the envelope but hesitated to read out what it said in side, leaving it to Dunaway to announce La La Land.
He returned to the microphone to say: "I want to tell you what happened. I opened the envelope and it said 'Emma Stone, La La Land', and that is why I took such a long look at Faye and at you.
"I wasn't trying to be funny. This is Moonlight for best picture."
The film's director Barry Jenkins said: "Very clearly even in my dreams this can't be true. But to hell with it because this is true. It's true, its not fake."
Paying tribute to the team behind La La Land for the way they handled the mistake, he said: "We have been on the road with these guys and it was so gracious and so generous of them."
Emma Stone won the coveted best actress prize, while La La Land also picked up best cinematography, best score and best original song for City of Stars.
It also won best production design.
Casey Affleck won best actor for Manchester by the Sea, while the drama also won best original screenplay.
Mahershala Ali won best supporting actor, for Moonlight.
He thanked his wife in his acceptance speech, telling the audience she gave birth to their daughter four days ago. It also picked up best original screenplay.'Celebrating living a life'
Best supporting actress went to Viola Davis for Fences, directed by and starring Denzel Washington.
The film is an adaptation of August Wilson's play of the same name.
"There's one place that all the people with the greatest potential are gathered - and that's the graveyard," she said as she collected her award.
"We are the only artists who celebrates what it means to live a life. Here's to August Wilson who exhumed and exhalted the ordinary people."
Davis, who had been nominated twice previously for Doubt and The Help, also thanked her "captain", Washington.