Hamada (浜田市) is a city in Shimane on the JR San'in Main Line.
Hamada lies on the JR San'in Line, and is served by all trains which pass through.
There are seven Limited Express trains per day in each direction: four Super Matsukaze and three Super Oki. Heading east, these take 1hr 15mins and ¥3190 to Izumoshi, 1hr 40mins and ¥4620 to Matsue and about 2 hours and ¥5270 to Yonago. Five of these trains continue as far as Tottori, taking 3hrs 15mins and ¥7330 (though you can also change at Yonago). Going the other way, they take 35 minutes and ¥2030 to reach Masuda; Super Oki trains continue along the Yamaguchi Line to Tsuwano, Yamaguchi, and Shin-Yamaguchi, reaching the last of these in 2hrs 10mins and ¥4940.
There are five Rapid Aqua Liner trains to Yonago a day, taking about 3 hours and costing ¥2590 (1hr 40mins and ¥1490 from Izumoshi). Local trains take 2hrs 20mins from Izumoshi, and may be overtaken by a Limited Express en route. Local and Rapid trains from Masuda take about 50 minutes and cost ¥760.
Going by train all the way from Osaka takes no less than 5 hours (if going via Shin-Yamaguchi) and costs ¥15,840.
Using the Shinkansen to Shin-Yamaguchi, Hakata is 3hrs 15mins and ¥9460 away (3hrs 40mins and ¥9250 if avoiding Nozomi trains). Allow at least 4hrs 30mins if you want to take the local trains on the Yamaguchi Line instead.
As a cheaper alternative to the Japan Rail Pass, JR West sells two regional rail passes covering Hamada, which are available to Temporary Visitors with foreign passports:
Iwami Kōtsū, Hiroden Bus and Chūgoku JR Bus operate the Isaribi-gō 16 times a day from Hiroshima, taking 2 hours 30mins (or, in the case of the non-stop buses, just over 2 hours) and costing ¥3030 (¥5340 return). This is an extremely useful shortcut to the San'yō Shinkansen at Hiroshima, so much so that long-distance travellers from points east should consider using it, even if they have a Rail Pass.
There are also two separate services from Osaka:
More information available on Wikivoyage