The officer responded to a neighbor's call about a suspicious person near I Street and 2nd Avenue about 3:30 p.m., said Salt Lake City police Sgt. Robin Heiden.
Barker was going door to door with a shovel, asking if he could shovel snow for money, Heiden said.
There was an immediate altercation when the officer arrived, the sergeant said.
"The officer was attacked with a shovel and returned fire and killed the man," Heiden said.
Three neighbors said that the gunfire sounded like fireworks, but Heiden did not immediately know how many shots the officer fired.
Det. Cody Lougy said the resident who called police thought Barker was suspicious because there was not enough snow to require shoveling. Also, Barker matched the description of someone who was looking into cars on Wednesday, Lougy said.
Police, who closed down streets in the area while they investigated, were speaking to at least two witnesses to the shooting, Heiden said.
A search of court records found that Barker had no criminal record, other than a March 2014 guilty plea to a misdemeanor charge of failure to disclose his identity to a police officer. Prosecutors dropped a disorderly conduct charge in the same case.
The shooting is the first homicide in the state in the new year.
Before Thursday's shooting, the most recent homicide, which was also the last of 2014, occurred in Stansbury Park in Tooele County and was also an officer-involved shooting.
Last year, Utah officers shot and killed 14 people, the highest number in at least five years.
Seven other people were shot by law enforcement last year but survived.
Reporter Bob Mims contributed to this story