Mazda is recalling more than 300,000 cars because the parking brake may not fully release or could fail to hold the cars, increasing the risk of a crash.
The recall covers certain Mazda 6 cars from the 2014 and 2015 model years and the Mazda 3 from 2014 to 2016.
The Japanese company said water can get into the brake caliper, causing a shaft to corrode and bind.
If that happens, the parking brake can get stuck in the on position or fail to fully engage. That can let the cars roll unexpectedly if parked on a slope.
The problem affects only cars with a hand-operated parking brake lever, according to documents posted by the US National Highway Traffic Safety Administration.
The company received its first report of the problem in April 2015 in Canada, but decided to monitor it because it had not received other reports.
By February this year, Mazda had 13 reports in the US of the problem happening on both models. It traced the cause to a sealing boot that was not keeping water out.
A collision was reported in Germany when a Mazda 6 rolled off unexpectedly, damaging the rear end. Another crash with bumper damage was reported in the UK. Mazda said it has no reports of injuries.
A company spokeswoman in the US said more than 307,000 cars were recalled in the US, Canada, Puerto Rico, Guam and Saipan. She did not have information about whether the recall extended to other countries.
Dealers will check the rear brakes. If shafts are corroded, they will replace the calipers. If not, they will replace a boot that keeps water out.
Owners will be notified starting from August 21.