The Australian Open champion was teetering on the brink of defeat after losing the first set and trailing 5-2 in the second but she raised her game to win 3-6 7-5 6-4.
“I was lucky to get through today,” American Williams told reporters. “I’m just super mentally tough, I feel like that’s definitely one of my strengths.”
While Williams had to dig deep, Dementieva had no real problems winning her semi-final against Victoria Azarenka of Belarus.
Dementieva cruised to a 6-3 6-1 victory at the Olympic tennis centre to remain on course to defend her title.
“I was trying to be very aggressive from the beginning of the match,” Dementieva said.
“I didn’t want it to go three sets, because I need to save some energy for the final.”
Williams was well below her best against Rezai but used all her big-match experience to turn things around in an ominous sign of her intentions before next week’s Australian Open.
“I felt like I literally lifted my game at that point, because I knew I was gonna be headed to Melbourne if I didn’t,” the world number one said.
“I kept thinking, I want to get a little more practice and I’d hate for it to end now.”
France were at least assured of a place in the men’s final after Richard Gasquet and Julien Benneteau won their last-eight matches.
Gasquet, who resumed playing this month after being cleared over a positive cocaine test, defeated Italy’s Potito Starace 6-3 7-6 and Benneteau beat Leonardo Mayer of Argentina 6-4 6-7 6-0.
“I had so many things very hard to do last year, so now I play for fun,” Gasquet said.”
Former Australian Open finalist Marcos Baghdatis of Cyprus also reached the semi-finals by beating Australian Lleyton Hewitt 4-6 6-2 6-3.
He meets American Mardy Fish who overcame Australia’s Peter Luczak 7-6 6-2.