Ding was on the ropes when Selby stormed back from 10-6 to 10-10 by firing four breaks over 50. But the Jester missed key balls in the closing stages as Ding battled his way to win the last three frames.
The 24-year-old from the Jiangsu Province, based in Sheffield, goes through to play Judd Trump in the semis over 33 frames. He becomes the third Asian player to appear in the semis, after Thailand's James Wattana and Hong Kong's Marco Fu.
Selby outscored his opponent 332-29 in the first four frames tonight, with runs of 55, 66, 89 and 92.
But the mid-session interval cost him momentum, and although he opened the next with a 53, he couldn't close the frame out. He led 61-30 on the last red but missed a simple pot to a centre pocket and Ding cleared the table, converting a difficult thin cut on the last black.
Frame 22 also could have gone either way as Ding made 40, then Selby also made 40 before missing a simple pink with two reds left. Ding was fortunate to move the last red off the cushion and he took advantage to clear up for 12-10.
A scrappy 47-minute 23rd frame saw Ding take a 51-7 lead, then Selby claw his way back. The Englishman should have cleared up but left himself an awkward final pink and missed it to a top corner. Ding thumped in a cracking long pink and added the black to clinch the result.
Ding, who is aiming for a rare Masters and World double, said: "He was excellent for the first four frames tonight. He was winning every frame with one chance. I didn't know what was going on, he didn't give me any chances. It was important for me to go 11-10 up because that put the pressure back on him.
"I'm looking forward to playing Judd now. He's done so well to win the China Open and get to the semis here. He's a nice boy with lots of girlfriends!
"It will be hard for me and I need to play better safety. I have to stop his potting. It's my first semi-final here and I don't know what the best-of-33 will be like. For now I feel strong and I'm not giving up any frames. I'm feeling more comfortable here and I know a lot of people in China are supporting me."
Selby has had a consistent season, reaching two ranking finals, but finishes it without a major peice of silverware. His chance of becoming the new World No 1 is also gone and that honour goes to Mark Williams.
"I shut him out to get to 10-10, he was struggling and seemed a bit nervous. But then I played two wrong shots in the next two frames. I should have gone 11-10 up but I tried to get on a colour off the last red to make sure, when I should have just rolled it in. Then in the next frame I was thinking about moving the last red off the cushion and I missed the pink.
"It wasn't pressure, just bad shot selection. If I'd got those shots right I might have won. Ding's a great player and more than capable of winning it."
Ball by ball scoring and results from tournaments