Welshman Williams, the world number two and twice Masters winner, had opened up a 3-1 lead, producing a break of 74 to take the third frame.
However, Australian Robertson responded, following up a clearance of 59 to snatch the fifth frame with a century break of 102 and then 69 to edge ahead 4-3.
— World Snooker (@WorldSnooker) January 15, 2019
A 53 break from Williams was not enough to claim the eighth frame, with a safety error on the pink punished before Robertson produced another unanswered run of 88 to seal his place in the quarter-finals.
Robertson, who failed to qualify for last year's tournament, said: "I had to pick up the pace, it was as simple as that.
"I had to force myself to play the way I do in practice in terms of the tempo. That's what I did and I got going and felt absolutely fantastic.
"To beat the world champion today was a huge step in the right direction," Robertson added, in quotes on worldsnooker.com.
Williams, meanwhile, admits he has some hard work ahead as he prepares to return to the Crucible in Sheffield to defend his title.
"I played poor all the way through really," the Welshman said. "I was expecting to play like that, to be honest, because I've hardly touched my cue.
"I'll have to start practising obviously with the World Championship coming up. It's the only tournament I'm looking forward to.
"I'll have to put a bit of work in for that otherwise I'll play like I did today and go out in the first round... (and) it'll be my own fault."
Robertson will go on to face Barry Hawkins after his 6-2 win over Shaun Murphy in Tuesday's late session.
Hawkins, the world number seven, had looked set for an early finish after he raced into a 5-0 lead following clearances of 86, 124 and 60.
In doing so, Hawkins became the 20th player to reach 300 career centuries.
Murphy, the 2015 Masters champion, sparked hopes of a comeback with a break of 74 to take the sixth frame before reducing the deficit again – but it was only delaying the inevitable.
"Anything can happen in this game and if he goes 5-3 then all of a sudden I'd start feeling it a little bit more. I was pleased to get over the line at last," Hawkins said.
Murphy was unable to reproduce the form which saw him reach last month's Scottish Open final.
"We all taste that horrible taste of defeat much more often than we have the excitement of winning," he said. "It's something that you have to deal with as a sportsman and just move on."