NEW YORK (AP) -- The Minnesota Timberwolves won the NBA draft lottery Tuesday night, the first time since 2004 the team with the worst record won the No. 1 pick.

After years of bad luck in the lottery, things finally worked out for the Wolves, who can perhaps choose between big men Karl-Anthony Towns of Kentucky and Jahlil Okafor of national champion Duke to put next to Rookie of the Year Andrew Wiggins.

"We're in this for big stakes," said Flip Saunders, the Wolves' president and coach. "The big thing about this is getting good talent that can blend together. This is another big step."

The Los Angeles Lakers moved from the fourth spot to second, keeping a pick they would have sent to Philadelphia if it fell outside the top five. The 76ers are third followed by the New York Knicks, who had the second-best odds of winning but instead fell to fourth 30 years after winning the first draft lottery and drafting Hall of Famer Patrick Ewing.

Not since Orlando won the right to pick Dwight Howard in 2004 had the NBA's ultimate game of chance came out in favor of the team with the best odds. The Timberwolves had a 25 percent chance of landing the top pick after finishing 16-66.

But their fans knew not to get their hopes up after the Wolves had fallen backward eight times previously, including both times they were in the pole position, 1992 and 2011.

Several hundred fans gathered to watch on the big screen at Target Center in Minneapolis and erupted when the Lakers card came out of the envelope for No. 2, meaning Minnesota had finally earned the top pick for the first time.

"Hope is nice to have," said Jason Vincent, a fan of the team since 2001.

The lottery sets the top three picks. The remainder of the 14 non-playoff teams follow in inverse order of their won-loss record.

Things went according to form until the Knicks slid back two spots. General manager Steve Mills hoped history could repeat by wearing Dave DeBusschere's Naismith Memorial Basketball Hall of Fame ring, which DeBusschere was wearing as the Knicks' GM when they won the 1985 lottery.

The lottery began that year as a way to prevent teams from losing on purpose as a way to secure the top pick. Tanking may still exist -- the 76ers have appeared to be angling for the draft with no regard for their record the last couple of seasons -- but the Wolves appeared to lose honestly while battling numerous injuries with a young roster.

Their victory, with owner Glen Taylor on stage, was only the fifth time the team that finished with the worst, or tied for the worst record, won the lottery.

The Cleveland Cavaliers had won the last two and three of the previous four lotteries since LeBron James left them for Miami in 2010. But with James back home, the Cavaliers are in the Eastern Conference finals and Miami was in the lottery, and the Heat held in the No. 10 spot where they entered.

The Heat's pick would have gone to Philadelphia if they fell out of the top 10.