The Chicago Cubs acquired left-hander Cole Hamels from the Texas Rangers on Friday for two minor league pitchers and a player to be named later.

The Cubs also received cash considerations from the Rangers.

Texas acquired right-handers Eddie Butler and Rollie Lacy in the trade. Butler, 27, is 1-1 with a 4.08 ERA in eight appearances for the Cubs this season and 0-3 with an 8.10 ERA in five starts at Triple-A Iowa. Lacy, 23, is 5-2 with a 2.45 ERA in 18 appearances (12 starts) in two levels of the Cubs' system. He is currently with the Cubs' high-A team in Myrtle Beach.

The teams had agreed to the trade Thursday, pending physicals for the players involved.

The Cubs stepped up their efforts on Thursday after losing out on lefty J.A. Happ, who was traded by the Toronto Blue Jays to the New York Yankees.

"To be able to change kind of the mindset, now to go on a first-place team, there's something inside of you that sparks when you get in those situations,'' Hamels said at the Rangers' ballpark after the trade was announced.

Hamels, who had been scheduled to start for Texas on Saturday in Houston, will instead travel then to join the Cubs for the rest of their series in St. Louis. The lefty said he wasn't sure yet when he would make his first start for Chicago.

Hamels, 34, has a 5-9 record and a 4.72 ERA this season but has been much better on the road -- away from hitter-friendly Texas -- where he has a 2.93 ERA. He has given up 16 home runs over 59 innings at home and seven home runs over 55 1/3 innings on the road.

Hamels will likely slide into the Cubs' rotation in place of Tyler Chatwood or Mike Montgomery. Chatwood walked six batters in the Cubs' 7-6 walk-off victory over Arizona on Thursday, giving him 85 walks in 94 innings.

A four-time All-Star, Hamels is 152-111 with a 3.43 ERA in his 13th season in the league. He played for the Phillies from 2006 to 2015 and won a World Series, a World Series MVP and an NLCS MVP with them in 2008. On July 25, 2015, in his last start for Philadelphia before being traded to the Texas Rangers, Hamels no-hit the Cubs at Wrigley Field.

The Cubs referenced that no-hitter in a tweet after the trade was announced.

Hamels has made six starts at Wrigley, where he's 3-1 with a 1.76 ERA.

"It's always that chase for that World Series, you start [to] realize how difficult it is to achieve,'' Hamels said. "That was something I wanted to be able to do in Texas, and it didn't happen. ... Going to Chicago, set up pretty nicely to be able to do so, I'm really excited to just kind of move right in and be a part of that.''

The Associated Press contributed to this report.