The tanker hit the central reservation halfway between junction 32 for Coryton and junction 33, Cardiff West, at about 17:45 GMT on Monday.
The westbound carriageway was closed from junction 30, Cardiff Gate, and one lane was also closed eastbound.
One person has been taken to the Royal Glamorgan Hospital in Llantrisant. Their condition was not known.
The Welsh Ambulance Service said other people involved in the crash were not injured.
There were long queues in both directions following the crash, but traffic has since eased. Diversions remain in place.
South Wales Police advised motorists to avoid the area for the rest of the night.
The Welsh Ambulance Service sent two rapid response vehicles, one ambulance and a doctor but an air ambulance could not be sent due to the weather conditions.
Two fire engines and one rescue tender from South Wales Fire and Rescue Service remained at the scene late on Monday evening to assist police.
Check if this is affecting your journey
One person has been taken to hospital after a serious crash on the M4 in Cardiff involving a tanker and a van.