The Knicks had won their first six games of the season and were the last team in the NBA to suffer a loss.
Memphis won its seventh consecutive contest after dropping its season opener.
The Grizzlies held only a 58-55 lead 2:30 into the third period, but they then went on a 19-1 run that broke things open.
Both teams made 37 field goals, but the Grizzlies attempted 11 more free throws than did the Knicks and made 10 more.
Gasol went 12-of-13 from the foul line and scored 24 points to lead Memphis, which now has the best record in the league. Randolph added 20 and Gay had 17.
Anthony led the Knicks with 20 points, but he turned the ball over five times and also was plagued by foul trouble. Raymond Felton had 18.