Scotland's favourite novel of the past 50 years is Trainspotting, the grim, gripping and darkly amusing novel by Irvine Welsh.

More than 8,800 votes were cast in the search for the nation's favourite novel as part of Book Week Scotland.

One in ten of the votes went to Welsh's debut novel, first published in 1993, with voters from nearly 60 countries around the world taking part.

The movie of the novel was also a huge success, and launched the careers of several actors, including Ewan McGregor and Kelly Macdonald.

Last night Welsh said: "I don't know if Trainspotting is the best Scottish book. But I'm obviously flattered to be on that list of great novels with those amazing writers."

Second in the poll is Alasdair Gray's seminal novel Lanark, published in 1981 and now considered one of the landmarks of 20th-century fiction. It was followed by Black and Blue by Ian Rankin. The Bridge by the late Iain Banks was fourth, with One Fine Day in the Middle of the Night by Christopher Brookmyre fifth.

Organisers Scottish Book Trust asked voters to choose from a short list of 50 titles compiled by the author, Aye Write programmer and literary critic Stuart Kelly.

Mr Kelly said: "Crime, comedy, science fiction, the avant-garde - the public vote has reinforced the diversity of contemporary Scottish writing. My sole regret is we have only one woman on the list. That said, The Trick is to Keep Breathing [by Janice Galloway] is indubitably a contemporary classic."

The widow of Mr Banks, Adele Hartley, said: "Iain was a huge fan of his fans and I think he'd have been very flattered by their support and delighted to be in such fine company."

Mr Gray said: "My reaction is delighted astonishment that Lanark has been judged more popular than a book by Ian Rankin, and only regret that this wonderful honour had no money attached to it."

Ian Rankin said it was an honour to find himself in the top 10. He added: "I'm sure the results will be pored over and discussed, but what really matters is that books are still read with a passion. I feel sure this will be the case in another 50 years' time."

Christopher Brookmyre said he was thrilled his book was on the list, and it had been his intention to take the "excitement of Hollywood action movies and re-imagine them through a prism of Scottish sensibilities; so the book's enduring popularity would suggest I got the balance right.

"It was the book I most enjoyed writing, and remains the one I recommend to newcomers who haven't read my work before."

Marc Lambert, chief executive of Scottish Book Trust, called every book on the list an absolute gem. He added: "Aside from acting as a barometer of Scottish reading tastes, the list has amply fulfilled its purpose of generating an exciting debate and discussion around great Scottish books.

"Trainspotting is undoubtedly deserving of the top spot. It remains a brilliant read, and its publication was a key moment in the history of the Scottish novel."