US, but it was not underground to contain the effects.
The Buster-Jangle Uncle shot was a 1.2KTon shot at 17 feet underground. The purpose was to study cratering effects. Data from this shot was then scaled up to predict the effects of the MK-8 and MK-11 ground penetrator atomic bombs, which had a yield of 15 to 20 KTons.
every country that has done underground nuclear testing at some point exploded their first underground nuclear device. if you want the first country, that was the US. if you want the most recent, that was North Korea. but this could change any day.
U.s
All countries that have exploded nuclear devices have exploded their first devices. The USA was the first to detonate such a device and the only country to use nuclear warheads in combat. The most recent countries to test nuclear devices are India, Pakistan, and North Korea.
Many, but the US Buster-Jangle Uncle effects test was the first. It was 1.2KTons exploded at a depth of about 3 feet, to test cratering effects. It produced massive fallout levels. Most underground testing is done much deeper to prevent contamination.
India
I believe the first underground nuclear test explosion was done by the US at the Nevada Test Site. However it was not intended to contain the blast or radiation. It was an effects shot to evaluate cratering, the bomb was only 3 feet underground. It was part of the 1955 Teapot series.
US
North Korea
North Korea
1964
On February 29, 1960, the United States conducted a nuclear test known as "Operation Niblick," which was part of a series of tests at the Nevada Test Site. This test was significant as it involved the detonation of a nuclear device underground, contributing to the development of the U.S. nuclear arsenal during the Cold War era. The test highlighted the ongoing nuclear arms race and the strategic importance of underground testing to minimize radioactive fallout.
The Soviets got the "bomb" in '49 (they exploded their first nuclear device). Now, the US & USSR had the same weapon. Red China would be next. Then there would be three.