The Brazilian had looked to be on the verge of joining Tottenham earlier this week but the Blues have outmanoeuvred their London rivals and the forward will now move to Stamford Bridge subject to a work permit being granted.
A statement on www.chelseafc.com read: "Chelsea Football Club can confirm an agreement has been reached with both Willian and his club Anzhi Makhachkala for the transfer of the Brazilian player.
"The transfer is subject to a work permit hearing on Wednesday."
The 25-year-old had got as far as completing a medical at Spurs but his about-turn will come as a boost to Blues boss Jose Mourinho, who has been looking to add to his attacking options this summer.
The Portuguese has had two bids rejected for Manchester United striker Wayne Rooney and is now being linked with another Anzhi player in Samuel Eto'o.
Mourinho hinted that Willian had chosen the Blues over Spurs in his press conference on Friday, although the player had yet to complete his medical at that point.
"I think he's already made his decision," Mourinho said.
The self-styled 'Special One' nodded in the affirmative when asked if that was Chelsea.
He added: "I don't like to speak before time because football can be crazy.
"I know what the player wants, so in this moment we cannot hide. That is a possibility."
Willian began his career in his homeland with Corinthians before moving to Europe with Shakhtar Donetsk in 2007.
He made over 100 appearances for the Ukrainians before moving to Anzhi in January of this year but his Russian adventure will be short-lived.
Mourinho is now likely to turn his intentions to getting Rooney, with a third bid planned after Monday's Barclays Premier League clash at Old Trafford.
Chelsea have been told repeatedly that Rooney is not for sale, but still Mourinho is chasing his man.
"When you own a player, you have a contract with a player for a long time, even if the player wishes to leave - and sometimes that happens," Mourinho said.
"That contradiction happens. The player wants to leave, the club wants to keep (him).
"We (managers) have to make a decision one way or another way. We have to persuade the player to stay, or the player persuades us to sell."
Asked how he rates Chelsea's chances of signing Rooney, Mourinho said: "I don't care. In this moment I don't care."
Where the Willian move leaves Spurs now is unclear, with the forward seemingly lined up as their replacement for Gareth Bale should he complete his move protracted to Real Madrid.
This latest development could prove to be yet another delay in the summer's longest-running transfer saga and possibly increase the chances of the Welshman staying in north London.