San Jose dropped out of first place in the Pacific Division, one point behind Dallas. The busy night of Western Conference action left San Jose and Los Angeles tied for seventh and eighth place with 88 points, Phoenix in ninth at 87, Colorado in 10th at 86 and Calgary in 11th at 85.
The Sharks will travel to Phoenix for a game Thursday and then will host Dallas Saturday.
Bobby Ryan scored for Anaheim midway through the second period but Ryane Clowe tied it less than a minute later and it was still a 1-1 game early in the third.
Selanne broke the tie by deflecting a shot from Luca Sbisa.
Anaheim clinched it with 9 seconds left when Corey Perry was credited with an empty-net goal. The puck did not go in the net, but the officials ruled a San Jose player intentionally knocked the net off its posts to prevent a goal.
'SNL': 'Anchorman 2' cast, One Direction sing 'Afternoon Delight' [VIDEO]
Trader Joe's: Car crashes into Long Island store, injuring 11