Ray Allen's 3-pointer with 32 seconds left highlighted a huge Miami rally, and the Heat advanced to the Eastern Conference finals by topping the Brooklyn Nets 96-94 on Wednesday night.

Paul Pierce and Kevin Garnett of the Brooklyn Nets at American Airlines Arena in Miami. (Mike Ehrmann, Getty Images)

The Heat won the series 4-1, and will face either Indiana or Washington in the East finals starting next week.

Miami had not led since late in the second quarter before Allen's shot from the left wing put the Heat up 93-91. Shaun Livingston tried to answer with 24 seconds left, missing in the lane and Chris Bosh controlled the rebound for Miami.

Allen made a pair of free throws with 21.6 seconds to play, capping a 12-0 run that erased an eight-point deficit.

LeBron James and Dwyane Wade each scored 28 for the Heat. Joe Johnson scored 34 for the Nets, including a 3-pointer with 11 seconds left that got his team within one.

(Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)