The National Union of Rail, Maritime and Transport Workers (RMT) said it would now consider whether to launch a walkout that could disrupt services over the festive period.
Of those balloted, 548 voted in favour of strike action and 264 against, with seven ballot papers spoiled. Turnout was 37%. The union said the ballot had delivered an overwhelming mandate.
But the result was attacked as "deeply disappointing" by ScotRail, which pointed out that, of the 2200 RMT members eligible to vote, only 24% had supported strike action.
The company promised to run as many trains as possible in any dispute. More than 95% of services were unaffected during the last RMT strike in 2010.
The RMT said its executive would now consider its next step and called on ScotRail to reinstate Scott Lewis, 40, immediately to resolve the dispute.
The ticket collector was dismissed in March for gross misconduct following an argument with a passenger travelling to Prestwick who had tried to claim a free travel offer as part of a Ryanair promotion.
ScotRail accused Mr Lewis of using "aggressive and intimidating" behaviour that reduced the passenger to tears.
But the RMT said Mr Lewis had been trying to help the passenger, who was described as a "fare dodger" in a leaflet distributed by the union.
Bob Crow, general secretary of the RMT, said: "Scott Lewis has been victimised and sacked for trying to help a passenger within the written procedures set out in ScotRail's own policies in what is a travesty of justice.
"RMT members will not sit back and watch while their colleagues are picked off in this fashion by a management who think they can fire staff without a single shred of evidence to support their case.
"That is why they have delivered this overwhelming mandate for action in this ballot."
In the ballot there was a higher level of support for industrial action short of a strike, which was backed by 81% of those who voted.
The company issued a strongly-worded reaction to the ballot, saying if staff thought such intimidating and aggressive behaviour towards a passenger was justified "they are in the wrong job".
It was earlier revealed, the two sides had clashed over controversial CCTV footage showing an argument between Mr Lewis and the passenger.
A ScotRail spokesman said: "The images underpin the dismissal on grounds of intimidating and aggressive behaviour towards a passenger, who was reduced to tears during the incident.
"If anyone believes such conduct towards a customer is acceptable – let alone worthy of a strike – then they are in the wrong job. The ticket examiner also had a compete disregard of correct ticket procedures."
The RMT would have to give seven days' notice before any industrial action was held, making the earliest strike date December 6.