The humpback has been seen at Pettycur Bay, Kinghorn in Fife.
Humpback sightings are not uncommon in Scotland, but a large whale so far up the Forth estuary is a lot more unusual.
Police Scotland is warning boat owners to keep a safe distance from the whale.
Lindsay Kerr, Police Scotland wildlife liaison officer, said: "This is a fantastic opportunity for wildlife watchers and marine tourism but it is essential that the health and well-being of the animals is considered at all times.
"The Forth estuary is subject to large tidal changes and any disturbance to the visiting whale could cause significant risk of it becoming distressed and moving further into shallow water and then becoming stranded by a rapidly outgoing tide.
"Legislation is in place to protect these marine mammals. Please enjoy this wonderful occurrence but do show respect to the whales and be aware of the protection afforded to them.
"I recommend boat and vessel owners follow the Wildlife Safe (WiSe) scheme. In this particular case, commercial and recreational users should not make any attempts to approach or actively pursue the whale.
"The scheme, which is a UK standard for commercial marine wildlife watching, includes a code of conduct and sets out best practice for wildlife watching."
Endangered species such as dolphins, porpoises and whales are protected by wildlife legislation including the Wildlife and Countryside Act 1981.
Under the Act, it is an offence to intentionally or recklessly disturb them.

Beauly will be the only representatives of the lower leagues in the semi-final draw at BBC Scotland's Pacific Quay on Monday 11 July.
This follows a heroic 1-1 draw away to in-form Kinlochshiel in which Beauly held a lead for more than half the game.
Lochaber also came close to creating an upset when they forced Kyles to come from behind twice to earn a 2-2 draw at Tighnabruich.
Camanachd Cup rules require drawn games to be replayed.
Meanwhile, at The Eilan, Newtonmore cruised to a 4-0 lead over Skye who then struck back with two late goals.
Kilmallie showed little regard for Oban Camanachd's Premiership status and went ahead three times in the first half through Liam MacDonald, Brian MacKay and Duncan Rodger only to be pulled back on each occasion by MacCuish. Connor Howe then got Camanachd's winner just after the hour.
Marc MacLachlan opened for Beauly after just three minutes and it was 11 minutes into the second half before John MacRae struck for Shiel to take the tie to a replay at Braeview.
Ben Delaney got Lochaber's opener and Dunky Kerr Kyles' first equaliser just before half time. Neil MacDonald shot Lochaber ahead again and Grant Irvine secured Kyles' second bite at the cherry at Spean Bridge.
An Evan Menzies double in the first half and one each from Norman Campbell and Iain Robinson in the second had Newtonmore on easy street. Jordan Murchison struck back with two in the last six minutes but by then it was too late for Skye.
In the Marine Harvest National Division a goal in each half from Alan MacDonald helped Inveraray to a 4-1 victory on Bute which extended their lead to four points.
The new second-placers in the five horse race for this title are Glasgow Mid Argyll who have three games in hand. This followed a 12-0 rout at Ballachulish where Gary Luke with a hat-trick headed a list of seven different scorers.

The left-arm seamer, 26, dismissed Kusal Perera with the final ball of the 46th over before removing Angelo Mathews and Thisara Perera in the 48th.
Faulkner finished with 3-45 as Sri Lanka made 288 in Colombo.
They bowled Australia out for 206 in reply to win by 82 runs and level the five-match series at 1-1.
Slow left-armer Amila Aponso, who made his debut in the opening match of the series, finished with 4-18 in 9.2 overs, with Matthew Wade's 76 the top score for the tourists.
Bruce Reid, Anthony Stuart, Brett Lee, Clint McKay and Dan Christian are the other Australians with ODI hat-tricks.
People who have been flocking to Fife to see a whale which has been breaching in the Firth of Forth are being warned from "making any attempts to approach or actively pursue" it.
[NEXT_CONCEPT]
Andrew MacCuish scored a hat-trick of equalisers for Oban Camanachd before the highly-fancied Premiership side eventually edged into the semi-finals of the Camanachd Cup 4-3 at Kilmallie.
[NEXT_CONCEPT]
All-rounder James Faulkner became the sixth player to take a one-day hat-trick for Australia as Sri Lanka won the second match of the series.