According to this link, it becomes a toss up between Scharnhorst and Warspite for hits fired from a moving ship against a moving ship. This is primaily due to there rangefinder/determination issue noted here. Roughly 26,000 to 26,400 yards.
http://www.navweaps.com/index_tech/tech-006.htm
But for overall ship to ship hit, I have yet to find any confirmed (with radar or other electronic instrument) hit further than USS Massachusetts/Jean Bart of 28,000-29,000 yards of moving vs stationary. This was measured with radar.
I was also able to turn up some reports of 30,000+ yard straddles, but no hits, at Leyte Gulf off Samar by the Japanese (34,000yards), and Iowa Class battleships (35,700yards) off Truk in Feb 1944
In all cases, some very good shooting.
F is for FIRE, That burns down the whole town!
U is for URANIUM... BOMBS!
N is for NO SURVIVORS...
- Plankton
LSM