Andrejs Borodins was in charge of the 1,300 tonne cargo ship Frifjord when a pilot from Dundee harbour found him staggering and incoherent.
The 53-year-old Latvian had planned to sail the 250ft ship from Perth to Norway in July.
Borodins was jailed for four months at Dundee Sheriff Court.
The captain's drunken state was discovered when pilot Barry Nisbet came aboard at Balmerino to help steer the vessel past the road and rail bridges on the Tay.
He sent Borodins to his bunk to sleep off his intoxication, with the first mate taking the wheel as the ship docked in Dundee.
Police attended and arrested Borodins, who failed a breath test. He pleaded guilty on indictment to a charge under the Railways and Transport Safety Act 2003.
Defence solicitor John Kydd said Borodins had been working at sea for 25 years, having previously done his national service in the Russian military.
He said: "It is lucky for him that the pilot did what he did otherwise there could have been a disaster - there could have been an accident.
"He was exhausted from doing back to back six hour shifts and that was his reason for drinking.
"He says he doesn't normally drink much -  this was abnormal for him."
Sheriff Alastair Brown jailed Borodins for four months, reduced from six months for his early guilty plea.
He said: "This charge is not equivalent to drink driving.
"You put yourself in a condition where you were unable to discharge your responsibilities as master of the vessel.
"I regard that as very serious - it is a gross breach of your duty."

The £5m signing from Lorient sustained the grade-three tear on international duty with Gabon.
Bluebirds boss Russell Slade is seeking clarification on how last season's player of the year suffered the blow during training between games.
"It is very difficult with Gabon to request what they have done and find out what they have done," said Slade.
"Training regimes are different. We could help them if we could get information on how they prepare and how they train as well.
"It's very important and we don't seem to get any dialogue from them.
"Obviously the medical  department and myself would like to know because it s out of our control what they are doing in the meantime."
Cardiff hope Ecuele Manga's fellow centre-back Ben Turner will be able to return from ankle surgery in an under-21 game on 13 November.
Meanwhile, Bluebirds captain and goalkeeper David Marshall is expected to return for Saturday's Championship clash at Preston after serving a two-match ban after a red card at Rotherham. Simon Moore has been deputising.
"When you break it down, Preston seem to be finding life a little bit tougher at home. Hopefully that continues for at least one more week," said Slade.
"Simon [Grayson] is a good manager, who has had several promotions to the Championship with various teams, so he knows his way around.
"He will set his team up to be very difficult. It has not quite happened for them at home yet but I am sure they will be more than capable of climbing the table in the coming weeks."

Nick Alexander, 35, from Weeley in Essex, was killed on 13 November, 2015, at the nightclub in Paris.
Artists including Fran Healy from Travis and Supergrass' Gaz Coombes performed at Shepherd's Bush Empire on Tuesday.
There was also a minute's standing ovation in Nick's honour.
LIVE: For more on this and other Essex stories
Mr Alexander was selling band merchandise for Eagles of Death Metal, who were performing at the nightclub, when he was killed.
The concert - called Peaceful Noise -  marked the official launch of the Nick Alexander Memorial Trust, which will provide musical equipment to small charities and vulnerable groups across the country.
Mr Alexander's older sister Zoe, 43, said the event was "really personal" to Mr Alexander and included performances by artists who had toured with her brother or were friends with him.
She said she would remember her brother as someone who "approached life head on".
"He packed a lot into those 35 years so we will remember him in that way - as somebody who embraced life and forged their own path," she said.
A drunken sea captain caught sailing a cargo ship up the River Tay while almost four times the legal alcohol limit has been jailed.
[NEXT_CONCEPT]
Cardiff City defender Bruno Ecuele Manga faces at least two months out with a groin injury.
[NEXT_CONCEPT]
Hundreds of people have attended a concert held in honour of the only Brit killed in the Bataclan terror attack a year ago.