The Lightning sent the Rangers center Vladislav Namestnikov, prospects Libor Hajek, a defenseman, and Brett Howden, a forward, along with their first-round pick in the 2018 NHL Draft and a conditional first-round pick in the 2019 NHL Draft.
[RELATED: Fantasy: 2018 NHL Trade Deadline roundup | 2017-18 NHL Trade Tracker]
Tampa Bay is first in the Atlantic Division with 87 points, the most in the NHL entering their game against the Toronto Maple Leafs on Monday.
The Rangers are last in the Metropolitan Division, seven points behind the Columbus Blue Jackets for the second wild card into the Stanley Cup Playoffs from the Eastern Conference.
"We're trying to do everything we can to improve our team, to give us the best chance we can to win the Stanley Cup," Lightning general manager Steve Yzerman said. "Ryan has got another year on his contract. We don't know what happens beyond next year, but he's currently 28 years old and has a lot of hockey left in him. J.T. Miller is 24, two years away from being an unrestricted free agent. We feel with the addition of these players, with our core, that we've given ourselves a better opportunity to win a Stanley Cup.
"I'm not sure how you define all in, but we did everything we could at this stage to improve the hockey team that made sense."
Video: Lightning acquire Ryan McDonagh from Rangers
McDonagh, who was Rangers captain since Oct. 6, 2014, is in the fifth season of a six-year contract and can become an unrestricted free agent after next season. He has 26 points (two goals, 24 assists) in 49 games this season and 238 points (51 goals, 187 assists) in 516 games during eight seasons with the Rangers.
McDonagh has 41 points (10 goals, 31 assists) in 96 Stanley Cup Playoff games.
He missed New York's past nine games with an upper-body injury but said he has been skating for a week and that he's 5-7 days away from feeling comfortable that he can play the way he needs to play.
"I'm going to do whatever I can to help [the Lightning] win," McDonagh said. "They're a top team in the League now, have been for a long time, and especially this season I think there's some big expectations there that I would love to help be a part of."
Miller had 139 points (57 goals, 82 assists) since the start of the 2015-16 season, second most on the Rangers. He was their second-leading scorer this season with 40 points (13 goals, 27 assists) in 63 games.
McDonagh and Miller join forward Ryan Callahan and defensemen Dan Girardi and Anton Stralman as former Rangers on the Lightning roster.
Video: Jamison chats with Rangers GM Jeff Gorton on trades
"I'm looking forward to reuniting with a lot of familiar faces, which I think is really going to help," McDonagh said. "Obviously, when you get traded to a new team, you want to fit in right away and feel comfortable, and having a lot of familiar faces there is going to help me."
General manager Jeff Gorton said it was difficult and emotional to trade McDonagh because of how much he meant to the Rangers since they acquired him in a trade from the Montreal Canadiens on June 30, 2009.
"It's a player that we view as a really special Ranger," Gorton said.
This was the second major trade the Rangers made in two days and their fifth trade in the past week. They traded forward Rick Nash and defenseman Nick Holden to the Boston Bruins in separate trades, forward Michael Grabner to the New Jersey Devils, and defenseman Ryan Graves to the Colorado Avalanche.
As part of the returns on all the trades, the Rangers added two first-round picks, a second-round pick and a third-round pick in the 2018 NHL Draft. They have 10 picks in 2018, including three in the first round, two in the second and two in the third.
They also acquired Namestnikov, Howden and Hajek from the Lightning; forwards Ryan Spooner and Matt Beleskey, defenseman Rob O'Gara, and defenseman prospect Ryan Lindgren from the Bruins; defenseman prospect Yegor Rykov from the Devils; and defenseman Chris Bigras from the Avalanche.
"There's a lot of opportunity here to grow as a team and make our team better," Gorton said. "That's our goal. That's our mission. That's what we're going to do. I feel like we're just starting."
Video: Erik Erlendsson on Lightning's Trade Deadline moves
Gorton said he liked the return he got for McDonagh and Miller because it gave the Rangers a lot of assets that fit their long-term plan of getting younger and faster.
Namestnikov, 25, has set NHL career highs for goals (20), assists (24) and points (44) in 62 games this season. He has 123 points (53 goals, 70 assists) in 263 games with the Lightning. He can become a restricted free agent July 1.
Howden, 19, has 58 points (22 goals, 36 assists) in 38 games for Moose Jaw of the Western Hockey League.
The Lightning selected Howden with the No. 27 pick in the 2016 NHL Draft. He had seven points (three goals, four assists) in seven games to help Canada win gold at the 2018 IIHF World Junior Championship.
Hajek, 20, was chosen by the Lightning in the second round (No. 37) of the 2016 draft. He has 10 points (three goals, seven assists) in 19 games for Regina of the WHL.
He was also one of the top defensemen at the 2018 World Juniors, when he had eight points (one goal, seven assists) in seven games for the Czech Republic, which finished fourth.
"That was an appealing part of these two players is the fact that they played in the World Juniors, they're a year further out of their draft," Gorton said. "I don't really know what our team is going to look like [next season], but there is certainly opportunity here for them to come in, show well and stay if that's the case."