Billed as one of the biggest match-ups in recent snooker history the pair ensured the final lived up to its billing with some sensational snooker throughout.
O'Sullivan took a 2-1 lead but he really should have been three frames up.
Selby nails doubled pink against O'Sullivan
Selby: O'Sullivan snooker's greatest player, but critics inspire me when I meet him
His failure to do so was punished as Selby took advantage of some poor mistakes from O'Sullivan, combined with some impressive potting of his own to open up a 6-2 lead at the break.
After the interval the Leicester man looked as if he was taking total control of the final when he won the ninth to go 7-2 up.
However O'Sullivan roared back to bring the match to 7-5 before the shorter break undid him, as Selby moved to 9-7.
Selby pulls off inventive cannon pot
In the seventeenth frame both players made fantastic pots but also basic errors, which resulted in a safety battle of the highest order.
O'Sullivan pots incredible swerve shot
Eventually O'Sullivan missed a red to right middle pocket and Selby capitalised and saw out the frame with a century break.
Emotional Selby clinches triumph over O'Sullivan
Mark Selby 10-7 Ronnie O'Sullivan: Frame-by-frame
Selby takes 6-2 lead over O'Sullivan into interval in UK Championship final