EAST LANSING, Mich. (AP) — Zach Edey made a go-ahead shot at the front of the rim with 2.2 seconds left and finished with a career-high 32 points and 17 rebounds to help No. 3 Purdue hold off Michigan State for a 64-63 win on Monday.

A 51-second sequence earlier in the second half, though, showed just how dominant the 7-foot-4 Edey can be at both ends of the floor.

Edey blocked a shot, had an alley-oop dunk, a defensive rebound and a layup to turn a one-point deficit into a three-point lead.

“He opens up a lot for us,” Boilermakers coach Matt Painter said.

The Boilermakers (17-1, 6-1 Big Ten) have won 17 of their first 18 games, matching a school mark set during the 1987-88 season.

The Spartans (12-6, 4-3) dropped a second straight game after winning seven in a row.

Tyson Walker put Michigan State ahead with 11 seconds remaining with a mid-range jumper, giving him a season-high 30 points, and Edey scored the winner on the ensuing possession.

After Edey’s last basket, A.J. Hoggard’s long inbound pass was knocked out of bounds by Purdue’s Brandon Newman with 1.8 seconds left. That left Tom Izzo with a chance to draw up a play to potentially win the game on Purdue’s end of the court.

Walker was set up with what seemed to be an open jumper on the left wing only to have Boilermakers guard Ethan Morton get a hand up to deflect the shot, leaving it short of the rim.

Purdue freshman guard Fletcher Loyer had 17 points, including a go-ahead free throw with 25.7 seconds left in a game that had the intensity of a matchup in March.

“I’ve known him since he was very young,” Izzo said. “The last give minutes of the game, he just took it over.”

Loyer’s older brother, Foster, played for the Spartans before transferring to Davidson.

Fletcher Loyer, a 6-4 freshman, scored a season-high 27 points Friday night in a win over Nebraska.

“He’s very aggressive, very sure of himself,” Painter said. “He’s not scared of the moment.”

Hoggard had 14 points and eight assists, playing well in the backcourt with Walker.

“I didn’t think we did a very good job of guarding their guards,” Painter said.

Joey Hauser added 10 points for the Spartans, who looked like they were going to be overmatched early in the game.

Purdue led by 13 points with 5:47 to go in the first half, but was ahead by just two at halftime after Michigan State started to make shots and cut down on turnovers.

“We lost the game in the first minutes with the ridiculous turnovers,” Izzo said.

The Spartans surged ahead by five points early in the second half before both teams took turns with the lead in a closely contested game with 13 lead changes and eight ties.

“In my heart I believe we competed well enough to win the game, but give them credit,” Izzo said.

BIG PICTURE

Purdue: Edey’s improved play and conditioning makes his tough to stop and sets up everything for coach Painter’s offense that runs through the junior from Toronto.

“I love playing inside out,” Painter said. “If you don’t have the horses, those plays don’t work.”

Painter said Edey has learned how to stay on the floor.

“When he first got here, he couldn’t pass and couldn’t play without elbowing people in the head,” he said.

Michigan State: Izzo said senior forward Malik Hall will be out “a while,” with a foot injury that is potentially a major setback for a team that lacks front court depth.

“Whether it’s the full year or not, we don’t know,” Izzo said.

UP NEXT

Purdue: Plays at Minnesota on Thursday night.

Michigan State: Hosts No. 23 Rutgers on Thursday night.

___

AP college basketball: https://apnews.com/hub/college-basketball and https://apnews.com/hub/ap-top-25-college-basketball-poll and https://twitter.com/AP_Top25