Nitrate ion is a common pollutant in surface and groundwater. Hence, its catalytic conversion into ammonia at ambient conditions by electrochemical and photoelectrochemical pathways is an attractive alternative to current ammonia production from the energy-intensive and high-carbon-featuring Haber-Bosch process. As such, developing highly active and product-selective catalysts with good durability and cost-effectiveness is highly desired. In this work, exfoliated MoS 2-x is reported as a highly active and selective electrocatalyst and a photoelectrocatalyst for nitrate reduction to ammonia. Exfoliation via the acid treatment of bulk MoS 2 results in exfoliated MoS 2-x , which is only a few layers thick and has a high degree of sulfur vacancies (ca. 12−13%). Electrochemical studies and electrolysis product analysis reveal promising nitrate reduction activity, which is found to be highly enhanced by the application of visible light illumination. The exfoliated MoS 2-x achieves a Faradaic efficiency of 69% with an ammonia yield rate of 5.56 mmol g cat −1 h −1 in the absence of a light source, which is enhanced to 80% with an ammonia yield of 7.48 mmol g cat −1 h −1 upon visible light illumination. DFT calculations support the binding of nitrate and other NO x species to the sulfur vacancies, resulting in the formation of *N, which is then reduced to ammonia.