Salah, who has scored 156 goals in 254 appearances for Liverpool, had entered the final year of his previous contract with talks stalling over the 30-year-old's wage demands.
However, the Egypt forward said he has more trophies at Anfield in his sights after finally puting pen to paper.
"I feel great and excited to win trophies with the club. It's a happy day for everyone," Salah told Liverpool's website.
"It takes a little bit of time, I think, to renew, but now everything is done so we just need to focus on what's next."
Since joining from Roma in 2017, Salah has become a fundamental part of Jurgen Klopp's side, helping establish them as serial contenders for domestic and European success.
He scored in the 2019 Champions League final victory over Tottenham and was the club's top scorer when they won the Premier League for the first time in 30 years in 2020.
Last season Salah was crowned Premier League player of the year by both players and football writers after scoring 31 goals that took Klopp's men to the brink of a historic quadruple.
Liverpool won the League Cup and FA Cup, but missed out on the Premier League title by a point to Manchester City and lost the Champions League final 1-0 to Real Madrid.
"I think you can see in the last five or six years the team was always going (upwards)," Salah added.
"Last season we were close to winning four, but unfortunately in the last week of the season we lost two trophies.
"I think we are in a good position to fight for everything. We have new signings as well.
"We just need to keep working hard, have a good vision, be positive and go for everything again."
Retaining Salah is a massive boost to Liverpool's chances of continued success under Klopp, who also signed a new deal to remain in charge until 2026 in April.
Liverpool had already lost one key player this summer when Sadio Mane joined Bayern Munich after six years at Anfield.
However, Darwin Nunez's arrival from Benfica for a fee that could rise to a club record 100 million euros (£85 million, $105 million) has softened that blow.