No one has confirmed yet whether it was a nuclear test or just a load of TNT going off designed to look like a test. Japanese aircraft will be sniffing along the North Korean coast looking for radiation.
A 5.1 on the Richter scale can mean a varied yield depending on the depth of the explosion, but I'd put it at the lower end of the thermonuclear spectrum. Given that the 2013 test was around 5.1 at 1km deep and was estimated at anything between 6-16kt, and that the DPRK has been digging tunnels and conducting work at that site since 2014, I'd wager that they've probably increased the depth to around 2km and dialled up the yield to 100-200kt. We're not talking Castle Bravo or Tsar Bomba yields here but still achievable with a thermonuclear device, and it's around the yield of a warhead from a Trident SLBM.