Not sure about the newer motors, but my 1996 Yamaha 225 OX66 'determines' speed (a loosely held term) via a pitot gauge.
On the leading edge of the foot of my motor is a 1/16" hole that goes to what looks like a large clear air supply tube for an aquarium.
That hose goes up and attaches to the speed port on your Yamaha helm gauge.
It is quite common for the pitot to get clogged with cr@p and show the speed anomoly that you are seeing.
With the motor tilted up, or with the boat out of the water, look for the pitot hole on the forward edge of the motor foot.
Once you find it, take a 1/16" drill bit in your fingers only, and then carefully spin it gently into the pitot hole to clear it.
You do not want to force the crud back into the hose... rather, you are working the crud out using the drill bit to cut through, and extract the crud.
I've only had to do this once, but it's stupid-simple to accomplish, and it takes only a few minutes to unclog that pitot hole and get your speed indicator working again!
Good luck!