In the reaction of hydrogen with metals to form metal hydrides, it acts as an oxidizing agent.
\(2Na(s) + H_2(g)\overset{\Delta}\longrightarrow2NaH\)
Here Na has been oxidized to Na while H2 is reduced to hydride ion. In the reaction of heated cupric oxide with dihydrogen to form H2O and copper metal, dihydrogen acts as a reducing agent
\(CuO(s) +H_2(g)\overset{\Delta}\longrightarrow Cu(s) + H_2O(g)\)
Here, CuO is reduced to Cu while dihydrogen is oxidized to water.