The American teenager will now face defending champion Victoria Azarenka in the last four in Melbourne.
Neither player grabbed the game by the scruff of the neck in the early stages of the first set, which went with serve until Williams broke through.
The world number three found an extra gear at a crucial moment to move 5-3 ahead, before serving out for a one-set lead.
Williams tightened her grip on the match by breaking at the first time of asking in the second set, profiting from a few unforced errors from Stephens's racquet.
After the 31-year-old consolidated the break, the match then swung in favour of the youngster. It was now Williams who was making all the errors, while Stephens began to blaze the ball around the court.
A big moment in the match came when Williams was on serve at 4-3 down and chasing down a ball at the net.
She had to quickly apply the brakes to save from hitting the net and conceding the point, but let out a sharp yelp in agony.
Clearly hurt, Williams then surrendered her serve, which looked like it was suffering as a result of her injury.
She was moving gingerly at the back of the court and requested a medical timeout, but not before Stephens gifted her a break back.
The 19-year-old seemed to lose her concentration amid the uncertainty over Williams's condition. It turned out that it was a back spasm troubling the 15-time Grand Slam champion.
After three minutes off court receiving treatment, she came back and held to love. Her lateral movement now had a distinctive stutter, but she was hitting the ball hard and flat.
Stephens was able to cope with the torrent that came her way to break at 6-5 and force a deciding set.
Williams seemed to gather herself in the third set - that was after smashing her racquet to pieces at the changeover. Her movement became easier, although it was still not as fluid as usual.
The pair exchanged breaks of serve before Stephens claimed the vital one at 5-4 up to seal a momentous victory.