CLEVELAND (AP) — LeBron James chewed on his fingernails as he talked quietly with Mo Williams in the corner of Cleveland’s muted locker room.

As they reviewed the game’s final seconds, the two stars stared blankly at a boxscore floating in an ice tub above James’ feet.

They looked stunned. And for good reason.

No longer untested, no longer unbeaten. The Cavaliers finally met their match in the playoffs.

Dwight Howard scored 30 points, Rashard Lewis added 22 and the Orlando Magic rallied from a 15-point halftime deficit to hand James and the Cavaliers their first loss of the postseason, 107-106 on Wednesday night in the Eastern Conference finals opener.

James finished with 49 points, eight assists and six rebounds, but the league MVP limped off the floor after Cleveland’s loss — just its third in 46 home games.

“Nobody said it was going to be easy,” said Cavs guard Delonte West, who missed an open 3-pointer with five seconds remaining. “This one hurts.”

Lewis made a 3-pointer with 14.7 seconds left and the Magic, who dethroned the champion Boston Celtics in seven games in the previous round, survived two shots by Cleveland in the closing seconds. Williams missed a catch-and-shoot jumper off a jump ball as the horn sounded, dropping the Cavs to 8-1 in the postseason.

“It’s a big victory,” said Howard, who broke one of the shot clocks with a dunk in the opening minutes. “We kept fighting the whole game. We kept believing we could win.”

Hedo Turkoglu scored 15 points with 14 assists for Orlando.

Game 2 is Friday night at Quicken Loans Arena, which fell eerily silent after the Magic’s win.

As fans headed to the exits, they turned to observe James still on the floor and bent over in obvious pain. He was bothered by cramps throughout the fourth quarter and was tended to by Cleveland’s training staff before slowly making his way to the locker room.

“I’m not hurt,” said James, who felt the long layoff — the Cavs hadn’t played since May 11 — may have contributed to the cramping.

Cleveland gave this one away. The Cavaliers lost their grip on the game with a stagnant third quarter that carried into the fourth. Also, the Magic shot 55 percent from the floor — 59 percent in the second half — against the league’s top defensive team.

“That’s unacceptable,” James said. “We should have lost.”

Orlando, which went 2-1 vs. Cleveland in the regular season, took its first lead at 85-84 with 10:06 left when Anthony Johnson buried a 3-pointer from the left corner. The bucket seemed to suck the air out of the raucous building and Cavs coach Mike Brown quickly called a timeout to stop the Magic’s run and get James back in.

The Magic, though, kept making big shots with Lewis hitting a jumper with 31.6 seconds left to give Orlando a 104-103 lead.

James then drove and scored on a runner while drawing a sixth foul on Howard, who added 13 rebounds. James completed the three-point play for a 106-104 lead but Lewis came down and nailed his 3-pointer over a closing Anderson Varejao.

“You got to play 48 minutes,” Lewis said. “The most important thing is to play 48 minutes. We played only one half but it was the second half.”

On Cleveland’s last possession, West missed his open 3 but James was able to tie up Turkoglu for a jump ball. James tipped it behind him to Williams, but his last-second prayer hit the back of the rim and the Cavs walked off knowing they had given up home-court advantage for this round.