The Yamato Cannon charges up for 3 seconds, then releases an intense blast of concentrated energy at the target, dealing 300 points of damage. Although the casting range is 10, once the spell has been initiated, the target will be affected within a range of 20.
Overall, Yamato Cannon is used to deal high damage in a burst to targets of high-importance for your opponent's army. This can include Thors, other Battlecruisers, static defenses, Carriers, and so on.
It is also a very good spell for speeding up the destruction of tech buildings if your opponent is not at his base when you attack.
With the Battlecruiser's weapon range of only 6 and its very low mobility, the Yamato Cannon is used defensively to quickly dispose of natural enemies such as Vikings, Corruptors or Void Rays.
The Yamato Cannon ability is just as good as it was in Brood War - if not better, because its charge time and damage have improved. The most significant improvement over Brood War is against Carriers. One use of Yamato on a shielded Carrier can severely injure it, but gives an opportunity to escape. To make best use of the ability, first use EMP (two doses) on the Carriers to remove their shields. An unshielded healthy Carrier will be destroyed in exactly one Yamato shot. Considering the Protoss shield recharge mechanic (it only takes 1 shield point to survive), you have about 5 seconds between using EMP and firing the Yamato to get the kill. In the event of a Carrier vs Battlecruiser battle, Battlecruisers will always come out on top with quickly fired Yamato blasts.
With spells not being subject to armor values nor Hardened Shield, a Yamato Cannon will instantly destroy an Immortal. Void Rays make excellent targets as they are very dangerous against Battlecruisers.
Battlecruiser vs Battlecruiser battles can sometimes occur, and these battles are usually decided by the Yamato Cannon ability. The spell is also extremely useful against Thors, as well as against Vikings attempting to kite the Battlecruiser.
Zerg does not have any units which are very good targets for the Yamato Cannon ability, but it can help to quickly destroy a large force of Brood Lords, and can also be used to defend against Ultralisks attacking a base.
Yamato Cannon use also helps Battlecruisers quickly kill Corruptors.
In Combination with Other Spells
This spell can be combined with Ghosts' EMP Round against Protoss, most notably vs. Motherships and Carriers. An EMP plus 2 Yamato Cannons will quickly destroy a Mothership.