Logan Couture and Joe Pavelski scored goals 30 seconds apart late in the third period to help the San Jose Sharks clinch their ninth straight playoff berth with a come-from-behind 3-2 victory over the Dallas Stars on Tuesday night.

Raffi Torres also scored for the Sharks, who moved into a tie for fourth place in the Western Conference with Los Angeles with two games remaining in the race for home-ice advantage in the first round. The Sharks visit the Kings in the season finale on Saturday.

Antoine Roussel and Loui Eriksson scored for the Stars, whose playoff hopes were dealt a serious blow. Dallas remains two points behind ninth-place Detroit and three behind eighth-place Columbus in the race for the final playoff spot. The Red Wings have a game in hand over both teams. The Stars end the season with home games against Columbus and Detroit.

Dallas looked as though it would gain two points in San Jose behind a strong night from Kari Lehtonen but it was all erased in a flash late in the third period.

First, Pavelski tipped Brad Stuart's point shot in with 5:37 remaining to tie the game.

While the sellout crowd was still celebrating that goal, Justin Braun's point shot went to Patrick Marleau who slid the puck to an open Couture, who knocked in his 20th goal of the season. Lehtonen made 34 saves but had no chance on Couture's game-winner with 5:07 remaining.

Antti Niemi made 24 saves in his 24th straight start for San Jose.

The teams traded goals in the first period with the Sharks striking first. Torres tipped in a centering pass from Scott Gomez for a power-play goal, and the Stars answered when Roussel beat Scott Hannan to a long rebound of a shot by Cody Eakin.

Dallas had chances to take the lead when Stuart was sent to the box for interference with 1:21 remaining on an elbowing penalty against Hannan. The best chance on that 5-on-3 came when San Jose's Justin Braun was stopped on a partial breakaway by Lehtonen.

Shortly after that two-man advantage ended, Marc-Edouard Vlasic was called for slashing at the end of the first period giving Dallas 28 seconds more of 5-on-3 play to start the second period.

The Stars didn't squander that chance when Eriksson knocked in a rebound 17 seconds into the period to make it 2-1.

Lehtonen protected that lead the rest of the period, making tough stops on Vlasic, Dan Boyle and Andrew Desjardins to keep Dallas ahead heading into the third.

NOTES: San Jose has lost five times in its past 16 games with three coming against Dallas. ... Stars F Alex Chiasson, who scored three goals in two wins over San Jose earlier this month, sat out with a shoulder injury. ... San Jose D Jason Demers missed his second straight game because of a lower-body injury. ... The Sharks sold out every regular-season game for the third straight season.