Theresa May said the diplomats, who have a week to leave, were identified as "undeclared intelligence officers".
She also revoked an invitation to Russia's foreign minister, and said the Royal Family would not attend the Fifa World Cup later this year.
Russia denies being involved in the attempted murder of Sergei Skripal.
The Russian Embassy said the expulsion of 23 diplomats was "unacceptable, unjustified and short-sighted".
It is the largest mass expulsion since 31 were ordered out in 1985 after double agent Oleg Gordievsky defected.
Former spy Mr Skripal, 66, and his daughter, Yulia Skripal, 33, remain critically ill in hospital after being found slumped on a bench on 4 March.
Det Sgt Nick Bailey also fell ill responding to the incident, and is in a serious but stable condition, but is thought to be improving.
Moscow refused to meet Mrs May's midnight deadline to co-operate in the case, prompting Mrs May to announce a series of measures intended to send a "clear message" to Russia.
Among them are:
- The expulsion of 23 diplomats – who have one week to leave
- Increased checks on private flights, customs and freight
- The freezing of Russian state assets where there is evidence they may be used to threaten the life or property of UK nationals or residents
- Ministers and Royal Family to boycott the Fifa World Cup in Russia later this year
- The suspension of all planned high level bi-lateral contacts between the UK and Russia
- Plans to consider new laws to increase defences against "hostile state activity"
Mrs May told MPs that Russia had provided "no explanation" as to how the nerve agent came to be used in the UK, describing Moscow's response as one of "sarcasm, contempt and defiance".
She said the use of a Russian-made nerve agent on UK soil amounted to the "unlawful use of force".
Soldiers wearing protective clothing prepare to lift and recover a vehicle in Gillingham, Dorset
The PM, who was earlier briefed by senior intelligence chiefs in Downing Street, added there was "no alternative conclusion other than that the Russian state was culpable" for the attempted murder of Mr Skripal and his daughter.
She said it was "tragic" that Russian President Vladimir Putin had "chosen to act in this way".
Labour leader Jeremy Corbyn was jeered by Conservative MPs as he asked Mrs May how she had responded to requests from the Russian government for a sample of the nerve agent so it could run its own tests.
He condemned the Salisbury incident as a "dreadful, appalling act" and called for multilateral action in response, saying it was a matter of "huge regret" that the UK's diplomatic network had been cut by 25% in the last five years.
The Foreign Office has updated its advice on travel to Russia, saying "heightened political tensions" mean Britons should "be aware of the possibility of anti-British sentiment or harassment at this time".
In a statement, the FA said it would work closely with the UK government and authorities regarding its participation in the World Cup in June.
Meanwhile, the police and army have sealed off areas of the north Dorset town of Gillingham as part of the attempted murder investigation.
A wide cordon is in place around a truck, thought to have recovered Mr Skripal's car from Salisbury, about 20 miles from Gillingham.
About 180 troops have been deployed to Salisbury to assist with removing vehicles and objects from affected areas, while the Zizzi restaurant and Bishop's Mill pub where the Skripals visited before falling ill remain closed.
Police from 15 forces across England and Wales have been sent to Wiltshire to support the investigation.