Five-time world champion O’Sullivan trailed Selby 16-14 but won two frames in quick succession and then clinched a tense decider to reach his seventh final at the Crucible.
Earlier in the match, O’Sullivan led 5-3 but Selby fought back to go 9-7 ahead. Selby could have extended the gap to 14-9, but O’Sullivan fought back to ensure he ended the second session trailing just 13-11.
‘The Rocket’ started the final session with 114 and took the next to level the contest with his fourth frame in a row.
Selby found his feet again with a counter-break of 56, and a 63 then put him within two frames of victory.
O’Sullivan won the following frame, but some poor decision-making allowed Selby to go 16-14 up.
‘The Rocket’ went on the offensive and made a 138-total clearance to ultimately force a final-frame decider with a break of 71.
O’Sullivan made 64 in the 33rd frame but missed the final red that he needed and Selby hit 34.
After some tense play on the red, O’Sullivan forced the error and cleared the colours to beat Selby in Sheffield for the first time.
O’Sullivan told the BBC: “For three days I’ve just been looking for a cue action where I can hit the ball half-straight.
“I’m watching him [Selby] cue up and he’s got the perfect set-up and the perfect start by trying to make the score look respectable, but some of my play wasn’t great. If I can find the cue action then I will enjoy the final. Cue action first and everything else is a bonus.”
In the best-of-35 final, O’Sullivan will face Kyren Wilson, who recorded his own dramatic semi-final victory over Anthony McGill earlier on Friday.
World No8 Wilson reached his maiden final having also won a final-frame decider.
The final, which will be played across Saturday and Sunday, will see fans return to the Crucible in Sheffield as part of the government’s programme of pilot events to test having crowds at sporting events.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies