Williams had a back complaint she'd tried to keep secret before Sunday but Ivanovic noticed almost immediately that her serve wasn't as fast as she'd expected, and she started taking big swipes at it.
The No. 14-seeded Ivanovic ended Williams' bid for a sixth Australian and 18th Grand Slam title with a 4-6, 6-3, 6-3 victory that took the hottest of favourites out of contention at Melbourne Park and opened up one side of the women's draw.
"It's not easy playing such a champion ... but she is also just a human," said Ivanovic, who beat Venus Williams in the final at Auckland, New Zealand earlier this month. "I just went out there swinging."
Williams hadn't lost a match since August, and went 78-4 in 2013. She came into the fourth round with those 25 straight wins, the second-longest streak of her career, and it was her 70th match at Melbourne Park, a record in the Open era. Williams had just set the mark for most match wins (61) ever at the Australian Open with her third-round victory.
The No. 1-ranked Williams didn't move her feet well, and was lunging for balls. When she tried to step up the intensity in the third set, her grunts becoming louder and more frequent until she toned it down after spraying a wild backhand wide in the next-to-last game, Ivanovic matched her stroke for stroke.
"It wasn't the best," Williams told a news conference, after being told that her coach had leaked news of a back problem.
"Again, I don't want to blame anything. I feel like Ana deserves all the credit," Williams added. "I feel she played unbelievable today. I think she went for her shots. It's not like I gave her the match."
Ivanovic advanced to the quarterfinals here for the first time since her run to the 2008 final and will next play the winner of Sunday's later match between Australian wild-card entry Casey Dellacqua and No. 30-seeded Eugenie Bouchard.
The other quarterfinal on this half will feature two women who'll turn 32 next month, after two-time finalist Li Na beat No. 22 Ekaterina Makarova 6-2, 6-0 and No. 28 Flavia Pennetta upset No. 9 Angelique Kerber 6-1, 4-6, 7-5.
Novak Djokovic continued his bid for a fourth straight title here with a 6-3, 6-0, 6-2 win over Fabio Fognini in 1 1/2 hours, while No. 3-seeded David Ferrer advanced to the quarterfinals by beating Florian Mayer 6-7 (5), 7-5, 6-2, 6-1.
In the 52 previous matches here where she'd won the first set, Williams had only ever lost one match — against fellow American Sloane Stephens in last year's quarterfinals.
The crowd was evenly divided at first but, sensing an upset, started backing Ivanovic, the former girlfriend of Australian golfer Adam Scott, as the match progressed.
After dropping serve twice in the first set, Ivanovic didn't face another break point in the second or third sets. She broke Williams three times, frequently standing well inside the baseline to receive.
She had 33 winners, including 20 on her forehand side. She also had a little bit of luck, when she drove a backhand into the top of the net, and it looped over and caught the line at an important stage of the third set.
"I had to remind myself all the time just to stay in the moment, because there were moments in the match where it could have gone either way," Ivanovic said. "But I really just believed in my game and stepped up when I needed to."
Ivanovic won her only major at the French Open in 2008, giving her the No. 1 ranking for a total of 12 weeks. But then she only advanced past the fourth round once at 22 Grand Slams.
"I had to break a spell, fourth round," Ivanovic said, "and what's the better place to do it than here against such a champion?"
Williams hit 22 winners but made 31 unforced errors, mostly on her backhand.
"I made a tremendous amount of errors, shots ... I haven't missed since the '80s," Williams said.
Williams, pausing to concentrate, was given a warning for a time violation in her last service game, and fended off a match point when Ivanovic netted a return.
In the next game, though, Ivanovic set up triple match point when Williams hit a service return too long, and then clinched it just under two hours.
Williams didn't say exactly what the back injury was, but thought she'd get over it in a few days with some rest. She'd thought about pulling out of the tournament, but it wasn't in her nature to concede defeat.
"Maybe I wasn't the best physically, but that had nothing to do with it," Williams said. "I think Ana just played a really good match. She did what it takes to win."
Williams won her last Australian Open title in 2010, and hasn't been past the quarterfinals since then, her campaigns often derailed by injuries at the season's first major.
"I think I have done pretty well here, in general over the history," she said. "I feel like I'll win it again."