Nadal broke the men's record for match wins at Roland Garros, where he improved to 59-1, with his lone defeat against Robin Soderling in the fourth round in 2009.
Saturday's victory completed the No. 1-ranked Williams' rebound from a shocking loss to 111th-ranked Virginie Razzano in the first round at Roland Garros a year ago. Since that defeat she's 74-3.
The seven-time champion twice let a lead slip away in the fourth set Friday, then came from behind in the fifth to beat the No. 1-ranked Djokovic 6-4, 3-6, 6-1, 6-7 (3), 9-7.
Djokovic, the winner of six major titles, seeks to become the eighth man to complete a career Grand Slam, but he'll have to get past seven-time French Open champion Nadal first.
Djokovic will next play 35-year-old Tommy Haas, who became the oldest French Open men's quarterfinalist since 1971 by beating Mikhail Youzhny 6-1, 6-1, 6-3. Haas is also the oldest man to reach the quarters at any major event since Andre Agassi at the 2005 U.S. Open.
Entering the tournament, seven-time champion Nadal had lost only 14 sets in 53 matches at the French Open. Now he has lost the opening set in each of the first two rounds.
Mattek-Sands won seven consecutive games to take a 5-0 lead in the final set after the second rain delay of the match. She served out the victory with the sun shining and rain falling, and became the fourth U.S. woman to reach the third round.
Djokovic began his bid to win his first French Open title with a 7-6 (5), 6-4, 7-5 victory Tuesday against 58th-ranked David Goffin of Belgium.
The Spaniard survived an early scare Monday and successfully began his bid for an eighth title at Roland Garros by rallying past Daniel Brands of Germany, 4-6, 7-6 (4), 6-4, 6-3.