Kim Kyoung-soo was found guilty of colluding with a blogger to artificially generate more than 88 million likes and dislikes on comments on 76,000 news stories.
The intent was to rig the algorithms of Naver, South Korea’s largest portal, to give more prominence to stories favourable to then-presidential candidate Moon.
In the event the liberal won the poll — held in the aftermath of the ouster of Park Geun-hye for corruption — by a landslide.
Kim had instructed the blogger — nicknamed Druking — to carry out the scheme and had been aware of an illegal computer programme being used, the Seoul Central District Court said.
The 51-year-old governor of South Gyeongsang province, who had denied the charges, will appeal but was immediately taken into custody.
“I will fight until the end,” Kim said, according to Yonhap news agency.
He retains his governorship for now but if the verdict is upheld by higher courts he will lose the position and be barred from running for office for five years.
Kim was also given a suspended 10-month term for violating political funding laws.
The blogger in the case was imprisoned for three and a half years for illegally manipulating public opinion and bribery.
In his ruling, the judge said Kim received “considerable help” from Druking and the rigging swayed public sentiment ahead of the 2017 vote.
A spokesman for the presidential Blue House said the verdict was “very unexpected”, adding: “We will wait patiently for the final ruling.”