The Chelsea man came off the bench to bag Germany's first goal moments into extra time, but was quick to concede that he was fortunate his shot found the net.
"Obviously we wanted to win the match earlier but Algeria did well, they pressured us from the beginning," he told ZDF.
"I scored almost the exact same goal in Mainz three weeks ago so I am capable of it but, of course, I had a little luck.
"We had many chances in the last 10 minutes of the 90 but we missed them. Now we are at the quarter-finals. We need to relax and then play France."
Germany will take on France in the quarter-finals, with the winner of that tie facing either Colombia or Brazil for a place in the final.