Following the discovery of high-temperature superconductivity in the La–H system, we studied the formation of new chemical compounds in the barium-hydrogen system at pressures from 75 to 173 GPa. Using in situ generation of hydrogen from NH3BH3, we synthesized previously unknown superhydride BaH12 with a pseudocubic (fcc) Ba sublattice in four independent experiments. Density functional theory calculations indicate close agreement between the theoretical and experimental equations of state. In addition, we identified previously known P6/mmm-BaH2 and possibly BaH10 and BaH6 as impurities in the samples. Ab initio calculations show that newly discovered semimetallic BaH12 contains H2 and H3– molecular units and detached H12 chains which are formed as a result of a Peierls-type distortion of the cubic cage structure. Barium dodecahydride is a unique molecular hydride with metallic conductivity that demonstrates the superconducting transition around 20 K at 140 GPa.