NEW YORK -- The Celtics won by beating out the Lakers, giving the draft lottery an old NBA Finals feel.
Yet, obvious by Magic Johnson's smile, the hated rivals were both celebrating.
The Celtics won the lottery Tuesday night to continue another amazing basketball springtime in Boston, capitalizing on a trade they made with the Brooklyn Nets four years ago.
A night after winning Game 7 against Washington to secure an Eastern Conference finals matchup with Cleveland, the Celtics cashed in their 25 percent chance to land the No. 1 pick in the June draft.
"Game last night, Game 7, a tough Washington team. Game tomorrow against a tough Cleveland team. And now we squeeze in the lottery and win the pick. I don't know what's happening here. It's pretty amazing," said Wyc Grousbeck, a Celtics owner who represented them on stage.
The Lakers moved up one spot to second to hold onto their pick. They would have had to trade it to Philadelphia if it fell outside the top three.
"When (Deputy Commissioner Mark Tatum) called out No. 4 and he said it wasn't us, I said 'Um, that's it, that's all I care about,"' said Johnson, the Hall of Famer in his first year as Lakers president. "I didn't know where we were going to land from there, but I was like `OK, I can breathe now."'
The Celtics finished dismantling the team that beat the Lakers to win the 2008 championship when they traded Paul Pierce and Kevin Garnett to Brooklyn on the night of the 2013 draft. Boston acquired the Nets' 2014, 2016 and 2018 first-round picks, as well as the rights to swap in 2017.
The timing was perfect for the Celtics, as Brooklyn finished with the worst record in the league.
"And look what I leave behind for the Celts on my way out (No. 1) pick," Pierce wrote on Twitter.
The 76ers will pick third, while Phoenix fell two spots and is fourth.
"I'm excited," 76ers rookie center Joel Embiid said. "We jumped up one more spot. I wish we would have gotten the No. 1 pick, but we trust the process and it's going to be exciting to see what we're going for."
The Celtics were going to be in prime position no matter how the Ping-Pong balls bounced in a hotel ballroom Tuesday. They were guaranteed no worse than the No. 4 pick to add to a team that had the best record in the East this season behind All-Star Isaiah Thomas.
"It's two completely different situations: One is a lot about the future, and one is in the present," Celtics president Danny Ainge said. "This team is a lot of fun to be around this year."
Their victory made it three straight years the team with the best odds has won the lottery, after going the previous decade without a victory. Minnesota snapped that streak by getting eventual Rookie of the Year Karl-Anthony Towns in 2015 and Philadelphia emerged with Ben Simmons last season.
The draft is considered a strong one, loaded with point guards such as Markelle Fultz, Lonzo Ball and De'Aaron Fox. Though the Celtics already have a top point guard in Thomas, Grousbeck said he expected they would make the pick.
And the Lakers will get a chance to take one of them after beating the odds to move up. They had about a 53 percent chance of falling out of the top three, which would have triggered a trade of the pick as remaining payment of their acquisition of Steve Nash in 2012.
Not only that, but they would have had to trade their 2019 first-round pick to Orlando if that happened, so Johnson was all smiles even after finishing behind the rival Celtics. A late five-game winning streak by his young team had damaged its odds by falling behind Phoenix for the second-worst record in the league.
"You see, you don't know what's been going on in L.A. They've been like `Oh my god, we blew it,"' Johnson said. "We won five in a row and everybody thought we were crazy. So now the fans back home can breathe a little easier."
Sacramento actually moved up into the top three, but the 76ers had the right to swap with them through terms of a past trade. The Kings will select fifth and 10th.
Orlando is sixth, followed by Minnesota, New York and Dallas. Charlotte is No. 11, with Detroit, Denver and Miami rounding out the 14 lottery spots.
The draft is June 22 at Barclays Center in Brooklyn.
AP Sports Writer Jimmy Golen in Waltham, Massachusetts contributed to this report.
2017 First-Round Lottery Results
2. Los Angeles Lakers
8. New York
Find the full 2017 NBA Draft order here.