Alvarez, 23, has only been part of Pep Guardiola's first team squad since last summer but has impressed so much that the club were keen to extend his deal on improved terms.
"This is a very proud moment for me and my family," he said. "For a club like City to put their faith in me like this is amazing.
"I have been really pleased with my first season here, but I have plenty more I can do. I know I can be better, and City offer me everything I need to fulfil my potential."
The Argentina forward signed for City from River Plate in January 2022 but remained in his home country until the end of last season. He arrived in Manchester in the summer and has scored 10 goals in 33 appearances since making his debut in July.
Alvarez's new contract will increase his weekly wage to bring him more in line with the rest of City's senior squad.
City have acted quickly to tie down another one of their star players. Almost all of Guardiola's squad, which has won four of the last five Premier League titles, have contracts until at least 2025.
"Julian has impressed everyone at Manchester City with his technical ability, dedication and attitude," City director of football Txiki Begiristain said.
"He is the ideal blueprint for a young footballer and an inspiration to anyone looking to make their way in the game. He has shown already here in England he has outstanding movement and natural goalscoring instincts.
"His progress so far has been really good, but we are now fully focused on developing his game even further and turning him into one of the best strikers in world football."
Ilkay Gundogan is out of contract at the end of the season and Kyle Walker's deal is set to run out in 2024. Sources close to City have denied reports that preliminary talks are underway to extend Walker's contract.