ATLANTA -- Bobby Cox was drenched with beer and champagne and hoisted onto the shoulders of his players after the Atlanta Braves gave their manager a final trip to the playoffs.

Atlanta reached the postseason as the NL wild-card team, a first for Cox, as Tim Hudson and the Braves took a six-run lead, then held on for an 8-7 victory over the Philadelphia Phillies on Sunday.

"This being Bobby's last year, losing today was not an option," Hudson said.

After the win, the Braves watched on TV as San Francisco beat San Diego 3-0, giving the Braves the NL wild card by one game over the Padres.

The players sprayed champagne in the clubhouse and then took the celebration outside.

"We fought and we fought and we fought," Hudson said of the 91-win season that included a nine-game losing streak in April and season-ending injuries to Chipper Jones, Martin Prado and Kris Medlen.

"I know there's not a team in this league that's got more heart than us," Hudson said.

Hudson, Matt Diaz, Derrek Lee, Peter Moylan and others lifted Cox onto their shoulders as fans chanted "Bobby! Bobby!"

Rookie Jason Heyward and other players had high-fives for fans.

"This is what it's all about," said closer Billy Wagner, who struck out the side in the ninth. "You play all year long and it comes down to the last game and you get the champagne shower."

Atlanta will start the playoffs Thursday at NL West champion San Francisco in the opener of a best-of-five series.

The Braves won 14 straight division titles with Cox but had missed the playoffs since 2005.

There was a postgame REO Speedwagon concert at Turner Field, and a few hundred fans remained after the concert to watch the Giants' win on the video board. They chanted and cheered after the final out as bubbly was sprayed in the Braves' clubhouse.

Cox had compliments for his team.

"We try hard," Cox said. "This team is the hardest-working, hardest-trying team we've ever had here."

Cox's final regular-season record was 2,504-2,001. He ranks fourth in wins, trailing only Connie Mack (3,776), John McGraw (2,840) and Tony La Russa (2,638). This is Cox's 15th season with 90 or more wins, second to only McGraw.

Cox also had 158 regular-season ejections, easily surpassing McGraw (117) for the most among managers.

He joked he was trying for No. 159 when watching on TV as the Giants beat the Padres in San Francisco.

"I was arguing with the umpire on every pitch," Cox said. "It could have been a 3,000-mile ejection."

Atlanta recovered after 11-5 and 7-0 losses in the first two games of the series with the Phillies.

Hudson (17-9) allowed four runs and two hits in seven innings against the NL East champions, giving up two-run homers by John Mayberry in the third and Jayson Werth in the seventh.

Wagner struggled in the Phillies' three-run eighth but recovered with a perfect ninth.

"It's a relief because you get a tomorrow," Wagner said. "We knew we had to win the game. We knew what was at stake."

Omar Infante and embattled infielder Brooks Conrad each had two hits and drove in two runs for Atlanta, and Derrek Lee homered.

"The bats came alive, which was great to see," Cox said. "We had much better hitting than we've had lately."

Cole Hamels started for the Phillies, and Roy Oswalt relieved in the third.

Hudson left with an 8-4 lead. The Phillies scored three runs off Jonny Venters and Wagner in the eighth. After allowing an RBI single by Wilson Valdez and pinch-hitter Ben Francisco's two-run double, Wagner struck out Raul Ibanez to strand runners on second and third.

Wagner, who like Cox is retiring after the season, struck out Shane Victorino, Brian Schneider and Greg Dobbs in the ninth -- each on called third strikes -- for his 37th save in 44 chances.

"The shadows helped, no doubt," Wagner said. "They could see fastballs but they couldn't see the spin of breaking balls."

The Phillies, hoping for a successful warmup for their postseason run for a third straight World Series appearance, had two injury scares.

Catcher Carlos Ruiz left after he was hit by a pitch on his left elbow in the third inning. X-rays were negative.

Left-hander J.C. Romero walked slowly off the field with left lower back soreness following a pitch in the sixth. He said he already had soreness and expects to be available for the playoffs.

Phillies manager Charlie Manuel used his starting lineup.

"We thought we'd give our best to the Braves," Manuel said. "We came back and we had a chance."

Hamels threw two hitless innings of 30 pitches in a tuneup for a Game 3 playoff start.

Manuel used much of his bench in the final innings.

"They've got some valuable playing time and some at-bats," Manuel said. "We got our work in. I feel good about that."

Cox moved Conrad from third base to second base after the rookie's two throwing errors in losses the previous two days.

Conrad's errors on throws to second base led to a combined seven unearned runs against the Phillies on Friday and Saturday. Cox said he made the change for Conrad's "peace of mind."

Conrad, who played most of his minor league career at second base, had a fielding error on a grounder by Ibanez in the fifth, but Hudson pitched out of trouble.

Hudson kept the Braves' four-run fourth live with a run-scoring single off Danys Baez (3-4) that set up Infante's two-run triple.

Baez allowed four runs and five hits while recording only two outs in the fourth.

Game notes

Attendance was 52,613 for an Atlanta-record three-game total of 158,048. Atlanta's previous best attendance total for a three-game series was 150,095 for a visit from the Cardinals in 1998. ... GM Frank Wren presented Cox a crystal baseball on the field before the game in recognition of Cox's 2,500th win on Sept. 25 at Washington. ... Heyward made a leaping catch of Victorino's drive before crashing into the right-field wall.