New York scored on a game-ending wild pitch in a three-run ninth inning to overcome Mike Trout's two homers for Los Angeles.