Los Angeles trailed by eight points with 4:22 to play but rallied behind the work of Farmar and Nick Young.
Farmar's layup with 1:21 remaining gave the Lakers a 103-101 lead and Los Angeles survived down the stretch to win its second in a row.
The Lakers wrapped up the game when Young stepped in front of Josh Smith to take an offensive foul with 1.9 seconds to play and Los Angeles clinging to a two-point lead.
Young then hit two free throws for the final margin.
Scarlett Johansson steps out with fiance after pregnancy reveal
Teacher apologizes for showing sexual image of herself in class