LOS ANGELES (AP) Ernests Gulbis of Latvia won the Farmers Classic on Sunday, rallying past top-seeded Mardy Fish 5-7, 6-4, 6-4 for his second career ATP tour title.

Gulbis entered the tournament on a five-match losing streak, but the inconsistent 22-year-old with a ferocious serve beat Xavier Malisse and former champ Juan Martin Del Potro before outlasting Fish, the top-ranked American and world No. 9, in a 2-hour, 43-minute final.

Gulbis went ahead 5-1 in the third set, but nearly blew it. Fish broke Gulbis' serve and rallied to 5-4 before Gulbis won three straight points in the final game, culminating in a forehand winner down the line.

Gulbis was just 14-14 this season before dominating the tournament on UCLA's Westwood campus.

Fish struggled late in his attempt at back-to-back victories, following last week's win in Atlanta.