Murray had won all eight of his previous battles with the 6ft 10in Isner but in their first clash on grass, the 20th-seeded American served brilliantly to clinch a superb victory.
The 37-year-old Isner hit 82 winners, including 36 aces, won 43 points of 61 at the net, and took both of his two break points.
"Look, it's no secret that I am most definitely not a better tennis player than Andy Murray," Isner said. "I might have just been a little bit better than him today.
"At the age I am at right now, I need to relish these moments. This is one of the biggest wins of my career. To play as well as I did against one of our greatest players ever is a huge accomplishment for me. He's a massive inspiration for every one of us in the locker room."
Murray, 35, who did not play competitively for two weeks coming into Wimbledon due to an abdominal injury, dropped his serve in the third game.
He forced two break points in the following game but 37-year-old Isner saved them both and maintained the advantage to take the opening set.
Isner took the second-set tiebreak 7-4 but Murray hit back to win the third set on the tiebreak, 7-3.
The momentum was with Murray but Isner broke for 3-2. At 4-2, the players had to wait for almost 10 minutes as they closed the roof because of darkness and when they resumed, Murray held and then had 0-30 on Isner's serve but could not take advantage.
Murray held for 5-4 but Isner served out with ease to set up a clash with 10th seed Jannik Sinner in the third round.
Murray said he was disappointed that his preparations for the tournament had been restricted by the abdominal injury he suffered in Stuttgart earlier this month.
"It's frustrating because I was in a good place with my game," he said. "That didn't help. I mean, the positive is that physically I was fine during the matches. It was touch and go kind of on the Wednesday, Thursday before the tournament in terms of how I was going to be. But I felt good physically on the court. I just couldn't quite get the win today."
Murray said he hopes to be back at Wimbledon.
"It depends on how I am physically," he said. "Physically I feel good, then we'll try to keep playing. But it's extremely difficult with the problems I've had with my body in the last few years to make long-term predictions about how I'm going to be even in a few weeks' time, never mind in a year's time.
"If physically I'm in a good place, yeah, I will continue to play. But it's not easy to keep my body in optimal condition to compete at the highest level."
Now Murray wants to get his ranking up from its current mark of 52 to a position where he will be seeded at Grand Slams.
"I was coming into Wimbledon feeling like I could have a deep run," he said. "If you're playing against top guys right at the beginning of the event, obviously makes it a little bit more challenging. That's kind of what my goals are between now and the US Open."