The Suns ended a five-game losing streak.
Nash was fouled on three straight possessions in the closing moments and his two free throws with 5 seconds left provided the final points. Iman Shumpert then missed a 3-point try for the Knicks at the buzzer.
New York lost its fourth straight.
Nash added 11 assists while Marcin Gortat had 11 points and 12 rebounds for the Suns. It was his sixth straight double-double.