Barcelona, however, made the most of what was their only clear scoring opportunity that they had thanks to the genius of Lewandowski.
The Polish striker secured Barca's points in the 20th minute when he sped into the area, made a brilliant cut inside to clear a defender and slotted the ball to the goalkeeper's left.
"It would not be right to explain everything with Ter Stegen and Lewandowski, there is more to it than that," Barcelona coach Xavi said. "Although it's clear that they have made the difference tonight. Marc is in spectacular form. And Robert is a world class goal scorer, maybe the best in the world.
"It's an important win at a tough stadium against a side that competes really well. We were patient. It is always hard to attack when there is no space, you have to be almost faultless. It was hard, we played how Mallorca wanted after the break and we can't allow that, we have to go for the second goal."
It was the Pole's ninth goal of the season, and eighth in the league. No player has scored eight goals in his first seven LaLiga games since Christian Vieri with Atletico Madrid in 1997.
Barcelona's victory lifted them to the top of the table on 19 points, one ahead of Real Madrid who have a game in hand and host Osasuna on Sunday aiming to restore their lead.
Mallorca are 10th in the standings on eight points after seven games.
- Notebook: Barcelona to wear Real Madrid colours?
"It's a pity playing such a complete game like we did against one of the best teams in the world and not being able to go out with at least a point," Mallorca left back Jaume Costa told Movistar Plus.
Xavi had a major headache in selecting his matchday squad after several key players reported back from international duty nursing injuries.
Xavi gave teenager Ansu Fati his second start of the season and his first in the league. The 19-year-old, fighting his way back from four surgeries to repair an injury to his left knee suffered in late 2020, started the move that led to Barca's goal, stealing the ball on the left and passing to Lewandowski.
But it was Ter Stegen who was responsible for Barca coming away with a win.
He made a magnificent stop with his right knee in the 35th minute, denying a close range first-touch strike from Jaume Costa.
Mallorca kept pressing after the break and the German keeper was once again there to stop an equaliser, deflecting an Antonio Sanchez shot from inside the box. He showed up again just before the final whistle to deny Kang-In Lee and secure the three points.
"It's hard to go back from the international break, we struggled but it's good that we came out with the win," Ter Stegen told Movistar Plus.
"It doesn't matter the score or how we got it, the win is what is important."
Information from ESPN's Sam Marsden contributed to this report.