The New York-based 1970s film was one of the defining movies of a generation, but Welsh believes the Scots actor is better in his role as a corrupt Edinburgh-based policeman.
Speaking before the Glasgow premiere of the film at Cineworld, the writer said: "I saw a performance a few years ago by Michael Shannon in the film Take Shelter and I thought it was one of the most remarkable portrayals I had seen since Robert De Niro in Taxi Driver. And I would say that James beats both of those in this film. You really dislike his character but you feel for him too, you want to know what happens to him. James just nailed it."
Filth tells the story of corrupt policeman Bruce Robertson and, although set in Edinburgh, was partially shot in Glasgow.
McAvoy said he was delighted to be back in his home city and at a screening so close to his alma mater, the Royal Conservatoire of Scotland. He said: "I am really proud and happy that we managed to get a screening here."