I certainly am not questioning his logic here. However, I am questioning what he thinks science has discovered, that "water is H2O".
In Naming and Necessity he states the following:
"Let's consider how this applies to the type of identity statement expressing scientific discoveries that I talked about before-say, that water is H2O. It certainly represents a discovery that water is H2O."
Again, this is not what science has discovered. The following is a more accurate description of what science discovered and how these terms "water" and "H2O" are actually used in scientific discourse and in ordinary language.
1. Science does not discover statements of identity but statements of composition. For example, it is more accurate to say, “liquids commonly named “water” may be composed of “H2O molecules.” Notice, this nicely leave the possibility of a liquid named “water” may not be composed of “H2O” at all. It is contingent truth whether any liquid named "water" will be composed of H2O molecules. One must go through the exercise of analyzing the liquid to see if some level of H2O molecules are present or none at all. After the liquid is analyzed for its components, a renaming of the liquid may occur depending on the purpose and focus of the scientific investigation. For example, if the pH of the liquid was of interest, the liquid might be renamed as an "Alkaline solution" or "Acidic solution".
2. Does it make sense to say one H2O molecule is water? Well, it depends how you use the term “water”. If the term “water” is used like “dihydrogen monoxide” than the answer is yes because “dihydrogen monoxide" means “H2O”. But this is simply a stipulation.
3. Science often uses the term “water” to mean a collection of H2O molecules. In this case, it does not make sense to say one H2O molecule is water. There are scientific implications in using the term “water” to mean a collection of H2O molecules. Can we still say “water is a collection of H2O molecules.”? But this is not quite right. Depending on temperature or pressure, the collection of H2O molecules might exhibit macroscopic states such as “ice”, “water” or “steam.” Each of these terms serves us well in our daily communication, we do say “I swim in water” but we don't say “I swim in steam”; we do say “I breath in the steam” but we don't say “I breath in the ice”; or we do say “The ice melted when exposed to heat” but we don’t say “The water melted when exposed to heat”
4. One can provide a variety of liquids call “water” and not share a common essence, for example, like “sea water”, “purified water”, and “heavy water”.
5. Chemists will name the same liquid differently depending on the property under examination. For example, the underlying component might be primarily H2O, but the name of the liquid might be something entirely different, 0.0.00001M NaOH solution emphasizes the hydroxide concentration while the same liquid could be named 10 Ci/mmol indicating the specific activity of radioactivity relative to the mass of the chemical in solution.
I do not see Kripke getting to an a posteriori necessary truth.
When you actually look at how these terms are being used, we can land into two natural places:
A. Liquid named "water" may contain "H2O molecules" which is a posteriori and contingent
B. "H2O is H2O" which is analytically true, necessary and a priori