MIAMI — This trip to the Eastern Conference finals did not come easily for Miami.

Down by eight with less than five minutes left, after trailing for virtually the entire game, the Heat found a way nonetheless to finish off the Brooklyn Nets and move into the NBA’s final four for the fourth straight season.

Ray Allen’s 3-pointer with 32 seconds left highlighted a Miami rally, and the Heat beat the Nets 96-94 in Game 5 of the Eastern Conference semifinals Wednesday night. The Heat won the series 4-1, improving to 9-0 at home in chances to close series over the past four seasons.

LeBron James scored 29 points and Dwyane Wade added 28 for the Heat, with Chris Bosh scoring 16 and Allen finishing with 13. James made one of two free throws with 9.5 seconds left to put the Heat up by two, and the Nets almost failed to get a potentially game-tying shot off after Paul Pierce lost it out of bounds, but it stayed with Brooklyn after replay. And the Nets still couldn’t get a shot away: Allen knocked it away from Joe Johnson as he made his move, and time expired.

Johnson had 34 points, Pierce scored 19 and Deron Williams had 17 for the Nets.

It’s the sixth trip to the East title series in the last 10 seasons for Miami, which is bidding for a fourth straight trip to the NBA Finals — something only the Lakers and Celtics franchises have accomplished.

James is heading there for the sixth time in eight seasons, the first two of those trips coming with Cleveland in 2007 and 2009.

The Heat will next face either fifth-seeded Washington or top-seeded Indiana. The Pacers lead that series 3-2, one win away from setting up a rematch with Miami that seemed like an absolute certainty for much of the season.

The tone for this one was set early, Brooklyn running out to an 11-4 lead before the game was three minutes old, clearly and predictably the more desperate team from the outset. The Heat weathered the early storm and when James Jones connected on a 3-pointer with 3:02 left in the half, Miami held a 42-41 lead.

S purs 104, Trail Blazers 82: In San Antonio, Danny Green and Kawhi Leonard each scored 22 points, and San Antonio overcame an injury to Tony Parker to close out the Western Conference semifinals with a victory over Portland.

Patty Mills scored 18 points and Tim Duncan had 16 points for San Antonio.

LaMarcus Aldridge had 21 points for Portland, while Damian Lillard added 17 points and 10 assists.

Kerr to coach Warriors

OAKLAND, Calif. — The Golden State Warriors are taking another chance on a television analyst and former NBA guard who has never been a head coach at any level.

The Warriors won the bidding war with the New York Knicks for Steve Kerr on Wednesday, hiring him away from the TNT broadcast table to be their coach. Kerr agreed to a five-year, $25 million deal with the Warriors, said his agent, Mike Tannenbaum.

Kerr had been in talks with the Knicks about becoming their next coach since Phil Jackson took over as team president in March. He won three titles playing for Jackson in Chicago and another two under Gregg Popovich in San Antonio.

Kerr spent three seasons as Phoenix’s general manager before stepping down in June 2010.

He replaces Mark Jackson, who was fired by the Warriors on May 6 after three seasons and back-to-back playoff appearances.

Kerr said last month that he has wanted to coach since going back to his job at TNT. And while the lure of building a contender with his mentor at Madison Square Garden looked appealing, the chance to coach a Western Conference contender in his home state proved to be too much.

The Warriors job is certainly a far more attractive one than when owner Joe Lacob hired Jackson away from the ESPN/ABC broadcast table in June 2011. The Warriors are coming off a 51-win season and consecutive playoff appearances for the first time in 20 years, and they’ve surrounded star Stephen Curry with a talented young core.

Kerr also has close ties to Lacob and Warriors President Rick Welts, who worked in Phoenix’s front office during Kerr’s time as Suns general manager. And while he has no coaching experience, Kerr played 15 seasons and — also similar to Mark Jackson — he has been around some of the most successful sideline leaders.

Kerr has credited Phil Jackson and Tex Winter for most of his basketball knowledge. Winter taught the triangle offense and was a longtime assistant for Jackson, who used the system to win an NBA-record 11 championships as a coach of the Bulls and Lakers.

Golden State also spoke with former Orlando Magic and Miami Heat coach Stan Van Gundy during its search. Van Gundy agreed to a deal with Detroit on Tuesday after the Pistons gave him control of basketball operations — something the Warriors wouldn’t do with Bob Myers and Lacob in place.

The Warriors met with Kerr again on Tuesday night in Oklahoma City, where Kerr was calling the Thunder-Clippers game. And they apparently made a big enough impression — and contract offer — to land the man they wanted all along.