ATLANTA (AP) -- Julio Teheran and the Atlanta Braves finally found a way to beat the Texas Rangers.
Freddie Freeman hit a two-run double during Atlanta's five-run second inning against Cole Hamels, Teheran pitched around five walks and the Braves held off a rally to beat the Rangers 5-4 and split a doubleheader Wednesday night.
Nomar Mazara had a two-run homer off Teheran in the nightcap for Texas, which won the first game 12-8 behind four hits from Elvis Andrus .
Otherwise, Teheran (10-11) avoided mistakes. He earned his second straight home win, allowing three runs, five walks and five hits in five innings.
"Obviously I don't want to give in or make a mistake," Teheran said. "… I know five walks is a lot but I didn't want to throw the ball over the plate where they could hit it."
The Braves took one win in the three-game series.
The Rangers are two games behind the Twins in the race for the second AL wild card.
Hamels (9-3) gave up five runs, four earned, in six innings. After facing 10 batters in the second, he allowed only one hit over his next four innings.
"Putting up a five-spot is definitely not the right way to go about it," Hamels said. "It's a tough thing to see from my side and, I'm sure, from my teammates."
Arodys Vizcaino gave up two-out singles to Jared Hoying and Carlos Gomez in the ninth. Vizcaino ended the game on Joey Gallo's fly ball to center for his 10th save.
Andrus drove in three and hit his 20th homer in the first game.
The Rangers finished interleague play with a 14-5 record, their 11th straight season finishing .500 or better against National League opponents.
Luiz Gohara (0-1), a 21-year-old native of Brazil, allowed six runs in four innings in his major league debut for Atlanta.
Gohara lost a 4-2 lead in the fourth, when he was hurt by walks to Gallo and Mike Napoli. Brett Nicholas hit an RBI double and pinch-hitter Will Middlebrooks followed with a tying two-run triple. Middlebrooks scored on a wild pitch to give Texas a 5-4 lead.
Andrus stole second base in the first inning of the second game, giving him 24, to go with the 20 homers, more than double his previous career high of eight last season. Jose Altuve and Mike Trout are the only other players in the majors with at least 20 homers and 20 steals.
"It's great company, the two best players in the league right now," Andrus said. "I'm really proud of the season I'm having right now, but it's not about me."
Also in the opener, Napoli hit a two-run homer for Texas. Matt Kemp and Ender Inciarte hit homers off Rangers starter Miguel Gonzalez, who allowed four runs in three innings. Inciarte had three hits.
Austin Bibens-Dirkx (5-2) threw three scoreless innings in relief of Gonzalez.
Rangers: Mazara left the second game with tightness in his left quadriceps.
Braves: C Tyler Flowers (wrist contusion) could come off the DL this weekend. … OF-IF Danny Santana was placed on the 60-day DL with a strained left quad. He came off the 10-day DL on Tuesday before it was determined he aggravated the injury in his minor league rehab.
The early afternoon game of the doubleheader was scheduled when Tuesday night's game was postponed by rain. There were 19,971 tickets distributed, but it appeared that only a few hundred fans were in the stands. Announced attendance for the second game was 20,364.
Braves RF Nick Markakis ran toward the right-field line and made a diving catch of a sinking liner hit by Delino DeShields in the fifth inning of the second game.
20-20 TEXAS SHORTSTOPS
The only other Rangers shortstop to have at least 20 homers and 20 stolen bases in a season was Toby Harrah, in 1975 and 1977.
Rangers: Following a day off Thursday, LHP Martin Perez (11-10, 4.87) will start when Texas opens a three-game home series against the Yankees on Friday night.
Braves: LHP Sean Newcomb (2-8, 4.31) will start when the Braves begin a four-game series against Miami on Thursday night. Newcomb allowed three runs in six innings in a 5-0 loss to the Marlins on June 16.