The 6-3, 4-6, 4-6, 6-4, 6-2 win means Murray is into the third round of a grand slam for the first time since 2017, when he reached the quarter finals as the top seed at the All-England Club.
The only place tennis fans can watch every Wimbledon match is on Stan Sport. Start a seven-day free trial of the Stan Sport add-on now!
Having downed the 24th seed, Nikoloz Basilashvili, in the opening round, Murray was forced to dig deep against Otte, ranked 152 in the world.
"I enjoyed the end," said Murray. "The middle part not so much.
"What an atmosphere to play in. The whole crowd was amazing but there were a few guys in there who were getting it fired up. I needed everyone's help tonight. They did a great job.
"I played some great lobs to finish it but it was a tough match."
The win sets up a third round clash with the Canadian 10th seed, Denis Shapovalov, who'd just turned six when Murray made his Wimbledon debut, way back in 2005, and means Murray keeps alive his record of having made at least the third round in each of his 13 appearances at SW19.
That streak appeared in grave danger as Otte stole the momentum, along with the second and third sets, in what was the biggest match of the 27-year-old German's career – a centre court showdown with a two-time champion and former world No.1.
Murray, having taken the first set, raced to a 3-1 lead in the second, before coming unstuck in spectacular fashion.
"I had to start doing something differently," Murray said.
"I started going for my shots more, started dictating the points more because I was being a bit negative, and because of the lack of matches, in the important moments I didn't make the right decisions a lot of the time.
"But I think I played the right way the last couple of sets. And the first set and a half was really good but there's just bits in the middle I would like to change."
Murray had a scare early in the fourth set, screaming in agony as he became another victim of the slippery centre court surface.
"That was a real, real cry of pain from Murray as he tried to change direction. Your heart is in your mouth as you watch," Andrew Cotter said on the BBC.
"You think of the groin issues that he's had and immediately the umpire is down to check."
With the roof closed at 2-2 in the fourth set, the raucous crowd got behind the local hero, who immediately broke Otte's serve.
A fifth set beckoned, the first time since 2005 that Murray had been taken that far in the opening week of Wimbledon.
"It's tough obviously going out and playing matches of that length when you know you have not had many matches, not played a whole lot of grass court tennis in four years," said Murray.
"So, yeah. It's been tough. That's one of the reasons why I'm still playing is because of moments like that. Why would you want to give that up?
"The atmosphere the last — I mean, it was good the whole match, but especially the last hour and a half was brilliant. I still enjoy that."
For a daily dose of the best of the breaking news and exclusive content from Wide World of Sports, subscribe to our newsletter by clicking here!