NEW YORK — On a night when the retiring third baseman had an error that cost a run and the veteran pitcher labored through five innings, it was youth that served a 4-3 win for the Braves against the sizzling Yankees.

Rookie shortstop Andrelton Simmons drove in two runs, and fellow 22-year-old Jason Heyward threw out a runner at the plate and had the game-winning RBI for the Braves, who snapped a three-game losing skid and ended the Yankees’ 10-game winning streak, the longest in the majors this season.

Tim Hudson (5-3) won for the second time in 12 career starts and six decisions against the Yankees, who led 2-0 after two innings and lost for only the second time in 18 games. The Braves snapped a six-game losing streak against the Yankees that included a three-game sweep last week at Turner Field.

Four Braves relievers pitched a scoreless inning apiece: Chad Durbin followed by Jonny Venters, Eric O’Flaherty and Craig Kimbrel, the 24-year-old closer who collected his National League-leading 20th save in 21 opportunities.

Hudson threw 109 pitches (65 strikes) and allowed four hits, three runs (two earned) and five walks with five strikeouts. It was anything but an efficient five innings, but he made some big pitches when needed most, including a bases-loaded strikeout of slugger Curtis Granderson to end the fourth inning. Hudson also got some crucial defensive assistance from Heyward in the fifth.

With the score tied at 3-all, Hudson issued consecutive two-out walks to Mark Teixiera and Raul Ibanez in the fifth, drawing manager Fredi Gonzalez from the dugout for a brief discussion with the pitcher. He left Hudson in to face Nick Swisher, who singled to right field, where Heyward was ready.

Teixiera tried to score from second base on the play, but Heyward fielded the ball while charging in and came up firing, throwing a perfect strike to catcher Brian McCann, who applied to tag to end the inning.

An inning later, Heyward put the Braves ahead with his two-out single that caromed hard off the foot of first baseman Teixiera. The hit scored Brian McCann, who led off the inning by bouncing a double over the center-field fence and advanced to third on a groundout. After Chipper Jones drew a two-out walk to put runners on the corners, Heyward’s hit put the Braves to stay.

Heyward had a big night, including two hits and a walk. He led off the third inning by hustling for a triple to the right-center gap, then scored on Simmons’ groundout to cut the Yankees’ lead to 2-1.

The Braves scored two runs in the fourth inning to take the lead, and could have had more. Martin Prado had a leadoff single and Freddie Freeman drew a two-out walk before Jones hit a two-out RBI double past Teixeira and down the right-field line.

Heyward walked and Simmons hit an RBI single to center field that looked like it would bring home two runs. Freeman scored on the play, but Heyward was thrown out at third base before Jones crossed home plate, erasing that potential run. The Braves had to settle for a 3-2 lead, and it wouldn’t last long.

The Yankees tied the score with an unearned run in the bottom of the inning after errors by corner infielders Freeman and Jones. Ibanez reached on the one-out fielding error by Freeman, in his first game back in the lineup after missing five games with a finger injury.

One walk and one strikeout later, Russell Martin hit a hard grounder that shot past third baseman Jones and into the left-field corner, bringing in the tying run. Jones didn’t appear to get his glove on the ball as it went past.

Derek Jeter, who seemed to have every close ball-strike call go his way all night, drew a two-out walk to load the bases before Hudson struck out Granderson, who leads the Yankees with 21 homers this season.

Venters gave up a hit and walk to start the seventh inning, and Robinson Cano’s ground out put two in scoring position. But Teixeira hit a fielder’s choice grounder to Jones, who made a nice play and threw home for the out. Venters struck out Ibanez to end the inning.