Selby led 9-7 going into the final session but struggled for form as it came to a scrappy conclusion.
Hawkins next plays either Ding Junhui or Mark King as he reaches the quarter-finals in Sheffield for the first time in his career.
A nervous first frame went to the pink, with Selby missing a cut black to right middle and Hawkins slotting a short and straight black to claim it.
World number 14 Hawkins made it all-square in the next frame before Selby retook the lead 10-9. The match quickened in pace as Hawkins shot a 64 to level again heading into the interval.
There was a re-rack in frame 21 and the match did not get any quicker from there. Hawkins did not mind though as he moved ahead for the first time since 2-1 then did enough to close out the match, with Selby looking subdued both at the table and in his chair.
"I struggled all the way through the match," Selby said.
"Barry played a lot better than me and scored a lot better than me. It is the same old story really, most of this season I have been struggling like that. I have won two majors but I have not really played that well."
Only four players - Steve Davies, Stephen Hendry and Mark Williams - have won the three major titles in the same season.
Selby missed the chance to go 10-7 ahead when he missed a relatively simple black and struggled to regain momentum.
Australian Open champion and world number 14 Hawkins will meet either Mark King or Ding Junhui in the last eight.
"It is my best ever result," he said. "It feels like I have won the world championship but I have not even made it through the quarter-finals yet."
SECOND SESSION REPORT
Mark Selby maintained his two-frame advantage over Barry Hawkins to lead 9-7 overnight in the last 16 at the World Championship in Sheffield.
Hawkins won the first two frames of the evening to square the match at 5-5. Selby stemmed the flow by clinching another slow frame, but Hawkins showed his mettle to square the game at six frames apiece.
Selby found his best form after the mid-session interval with some brilliant cueing and positional play, to which Hawkins had no answer as he reeled off three frames on the bounce to open a commanding 9-6 lead.
But Hawkins won the vital final frame of the evening to keep the deficit to two frames, with the game to be concluded on Saturday.
FIRST SESSION REPORT
Barry Hawkins blew a golden chance to remain level with Mark Selby after their opening session saw Selby carve out a 5-3 lead. Hawkins missed a long green in a tense final frame of the session, but watched as it then flew into a middle bag.
But the world number 14 could not take advantage of his good fortune as he ran out of position attempting to land on the black after slotting brown, blue and pink.
Hawkins watched as the black narrowly failed to drop with Selby, who had played a brilliant shot off several cushions to escape from a snooker and hole the final yellow, holed the easiest of blacks to complete a satisfactory conclusion to his eight frames.
The first four frames of the match were split with Hawkins rolling in 73 and 52 in the first and third frames as Selby contributed 98 and 103 in the second and fourth frames.
Selby moved 4-2 clear before an 89 enabled Hawkins to close to 4-3 behind.
It should have been 4-4, and Hawkins may yet rue his slipshod positional effort in the eighth frame.
- Sports & Recreation
- Mark Selby
- Barry Hawkins