The McGowan government said on Tuesday it would shut the state-owned Collie Power Station by 2027 and the Muja Power Station by 2029. Both are operated by Synergy.
The privately-owned Bluewater Power Station will continue operating, for now.
In a statement, the government also announced it would not support or commission any new gas-fired capacity after 2030.
"For more than a century Collie has literally powered the State - and my Government is absolutely committed to ensuring the town has a strong economic and jobs future," premier Mark McGowan said on Tuesday.
"The reality is our current electricity system is becoming increasingly unsustainable due to the uptake of rooftop solar and growing demand for renewable options for generation."
Collie is the only coal producing region in WA and provides roughly 10% of the state's energy requirements. The majority is gas fired with some renewables.
The timeline for closure is only two years later than the Liberal party had proposed in the last state election. The opposition was widely criticised for the policy by Labor resources minister Bill Johnston who said he was "horrified" by the "risky" commitment.
Along with the exit from coal, the McGowan government will invest $3.5 billion over the next 10 years, building renewable energy capacity to replace the stations.
It will include 800MW of wind capacity and 2000MWh of storage - namely batteries and pumped hydro.
There are currently around 1200 employees in the Collie region which will be directly impacted by the closure of the power stations.
The government said it would invest $547.4 million to support workers' transition into new careers.
In April, the government announced it would support privately-held Sunshot Energy to investigate opportunities to develop a renewable energy hub in Collie.
Sunshot was founded two years ago by climate activist and political organiser and donor Simon Holmes à Court.
The company is chaired by economist Ross Garnaut, who authored the Garnaut Climate Change Review, one of the most important reports considering the economic implications of climate change.
Sunshot will use the cash, granted via the Collie Futures Industry Development Fund, to conduct a feasibility study into a large-scale battery and hydrogen industrial hub.
Garnaut is leading the study which will focus on establishing a hydrogen electrolyser powered by renewables and an 800 MWh battery.
The sheer size of the battery is ambitious in itself. It is the largest battery to be proposed in WA, and more than triple the size of South Australia's Hornsdale project.
It is hoped the hub will produce commercial quantities of green hydrogen, and ammonia and urea for agricultural and industrial uses.