The incident happened when a carriage was derailed after hitting an object, and a second train then crashed into it when signalling was damaged.
British Transport Police (BTP) said ‘a number of people’ were injured in the incident, at Fisherton Tunnel close to London Road in Salisbury.
All passengers have been evacuated and injuries are believed to be minor, with PA news agency sources describing them as ‘walking wounded’.
The driver trapped after the crash has been released from his cab and taken to hospital - but is not seriously injured, sources confirmed.
Emergency services, including some 50 firefighters, attended the scene on Sunday evening with a critical incident being declared.
A Network Rail spokesperson said: ‘At around 7pm this evening, the rear carriage of the 5.08pm Great Western Railway service from Portsmouth Harbour to Bristol Temple Meads derailed after striking an object on its approach to Salisbury station.
‘The derailment knocked out all of the signalling in the area. Subsequently, the 5.20pm South Western Railway service from London Waterloo to Honiton then collided with the Bristol train.’
The derailed train was believed to be on its side, but the South Western Railway train is upright.
BTP said a casualty centre has been set up at St Mark's Church, in St Mark's Avenue in the city.
Transport Secretary Grant Shapps tweeted: ‘My thoughts go out to those affected by the serious rail incident near Salisbury.’
He said the Rail Accident Investigation Branch and Office of Rail and Road will investigate, adding: ‘We need to understand how this happened to prevent in the future.’
A mother who was out trick or treating with her family nearby likened the noise of the crash to ‘a bomb’ and ‘thunder’.
Tamar Vellacott said she was walking outside with her young children, mother and partner on Jewell Close, Bishopdown, around a kilometre from the scene.
‘It was a noise we've never heard before... my young ones started panicking thinking it was a bomb and we said maybe a lorry had crashed on the London Road and not to panic,’ the 25-year-old told PA.
‘There was no screeching like brakes, just a long rumbling sound like thunder hitting the railway line.’
An Office of Rail and Road spokesperson said: ‘We’re supporting Network Rail and the train operators, plus RAIB (Rail Accident Investigation Branch) and the British Transport Police with respect to the collision between two trains near Salisbury Tunnel Junction and liaising with emergency services responding to the incident.’
Transport Salaried Staffs Association general secretary Manuel Cortes said the incident was ‘a very sobering reminder about why safety on our railways is always paramount’.