Maria Sharapova fired six aces but made 14 double faults before saving a break point in the 10th game of the second set.
She then broke Errani in the penultimate game and held serve to end it on a forehand winner after just under 2 1/2 hours.
"I had a really difficult opponent," Sharapova said. "She really made me work for this match. A few ups and downs in the match but I'm really happy to get through."
Errani connected on 84 percent of her first serves but won only 47 of those 87 points as Sharapova broke her three times in each set for the triumph.
Four-time Grand Slam champion Sharapova will play for a spot in the final against the winner of a match later Wednesday between Serbian 22nd seed Jelena Jankovic and Italian 15th seed Roberta Vinci.
Sharapova, coming off a title at Indian Wells, has never won the Miami crown in four trips to the final, losing to Kim Clijsters in 2005, Svetlana Kuznetsova in 2006, Victoria Azarenka in 2011 and Agnieszka Radwanska last year -- all in straight sets.
"I've been so close to winning," Sharapova said. "I would love to win this. I've been coming to this tournament since I was a little kid. It would mean a lot to win it."
If she does reach the final again she would face either a rematch with Radwanska, the fourth seed from Poland, or world No.1 Serena Williams, who seeks her sixth Miami title.
On the men's side, Spanish third seed David Ferrer and Austrian Jurgen Melzer were set to meet later in the first quarter-final with Frenchman Gilles Simon and Germany's Tommy Haas, who ousted world No.1 Novak Djokovic, playing at night.