Office for National Statistics (OSN) data shows a 17 per cent rise in the number of overseas visitors to 3.2 million.
During the same year, tourist spending increased by almost a quarter (23 per cent) to £2.3 billion.
The figures are the highest since the ONS travel trends survey began in 1961/62.
The rise was driven by 1.9 million visits by European tourists, up 17 per cent on 2016.
Spending by visitors from Europe increased by 36 per cent to £1.1 billion.
In contrast across the UK as a whole, the number of European visitors increased by one per cent while spending fell by one per cent.
The Scottish Government attributed the rise to factors including the popularity of the Scotland-set television series Outlander, digital campaigns by tourism agency VisitScotland, and events associated with the Year of History, Heritage and Archaeology.
The figures are published amid ongoing debate about the impact of tourism at popular destinations such as the Isle of Skye.
Tourism Secretary Fiona Hyslop said: “These figures show 2017 was a record year for overseas tourists visiting and spending money in Scotland, which is great news for the industry and our economy.
“Tourism is one of our most important industries, employing 207,000 people, creating jobs, supporting the local economy and building on our strong international reputation.
“As we get closer to the UK’s departure from the EU, we will continue to do all we can to ensure people from across the EU and elsewhere are welcome to work in our tourism sector and visit our beautiful, vibrant country.”
Malcolm Roughead, VisitScotland chief executive, said: “Today’s figures herald a remarkable period for Scottish tourism, with overseas visits in 2017 reaching a record high.
“These outstanding results show that Scotland can compete on a global stage. Using our unrivalled beauty, rich history, pioneering partnerships and innovative thinking we are communicating with visitors from every corner of the world.
“Groundbreaking apps, creative digital campaigns and inspirational content means we can reach visitors and potential visitors at every step of their journey, informing the visitors of today and inspiring the visitors of tomorrow.
“Tourism is the heartbeat of the Scottish economy, causing a ripple effect which touches every industry and community, creating employment and economic growth.
“Buoyed by the success of today’s figures we look forward to continue working with our partnerships across every aspect of the tourism industry to make sure Scotland is at the top of everyone’s list to live and work, invest, study and visit.”