Williams provided seven assists and six steals and Paul Pierce sank four 3-pointers en route to 25 points as Brooklyn led from start-to-finish and snapped an 11-game losing streak.
The Nets posted their first victory over the Lakers since Nov. 25, 2007.
Overshadowing the win was the appearance of Brooklyn's Jason Collins, who entered the game 1:32 into the second quarter and made history by becoming the first openly gay active player in any of the four major North American team sports.
Collins, who was signed to a 10-day contract Sunday, played 10:37 minutes with no points and two rebounds.
He revealed his sexual orientation in an April article in Sports Illustrated.
Pregnant Mila Kunis wins 'Best Villain' at MTV Movie Awards
'Happy' fan videos make Pharrell cry [VIDEO]