Bayern Munich have announced that Robert Lewandowski has extended his contract until 2021.
The 28-year-old, who joined from Borussia Dortmund in 2014, has been in talks with the club in recent weeks over the renewal of a deal that was due to expire in 2019.
Bayern president Uli Hoeness stated last week he was "pretty sure" that Lewandowski would commit his future to the club, despite speculation linking him with a move to Real Madrid.
And the striker says he is delighted to have brought rumours over his future to an end with a new four-and-a-half-year deal.
"I am very pleased that negotiations have led to a positive outcome and that I've still got a few years ahead at FC Bayern," he told the club's website.
"We still have some great objectives together."
Lewandowski added via his official Twitter account: "This club gives me all i need to make my dreams come true! New challenges ahead of us!"
Bayern chairman Karl-Heinz Rummenigge said of the deal: "I'm delighted that we were able to tie one of the world's best centre-forwards to the club for the long term."
Deputy chairman of the board Jan-Christian Dreesen added: "They were intense but always respectful and fair discussions. I want to thank the representatives of Robert Lewandowski for the constructive negotiations."