Motorists have been urged to take care after heavy showers and thunderstorms were forecast to hit most of Wales.
A weather warning was issued from 12:30 BST on Tuesday until 06:00 BST. One has also been issued for Wednesday, from 12:00 BST until 21:30 BST.
The Met Office said properties could be damaged by floods, lightning and winds, and roads could close.
Police were "astonished" a driver only had minor injuries after losing control in the wet on the M4, near Bridgend.
South Wales Police said it was called to the single-car crash just after 07:00 near junction 35.
The force has warned motorists to "drive to the conditions", with up to 50mm of rain expected to fall in two to three hours in some areas.
Inc 176. Astonished that this driver walked away with minor injuries after loosing control in wet weather on the M4 near Bridgend this morning. More rain on the way. Please drive to the conditions. pic.twitter.com/DN2TNbixOo— South Wales Police Roads Policing Unit (@SWP_Roads) June 16, 2020
The weather warning covers Blaenau Gwent, Bridgend, Caerphilly, Cardiff, Carmarthenshire, Ceredigion, Conwy, Denbighshire, Flintshire, Gwynedd, Merthyr Tydfil, Monmouthshire, Neath Port Talbot, Newport, Powys, Rhondda Cynon Taf, Swansea, Torfaen, Vale of Glamorgan and Wrexham.
Flooding of property "could happen quickly", train and bus services could be cancelled, communities might become cut off if roads flood, and there may be power cuts, the Met Office said.