Iowa farmers are nursing their crops through the most prolonged drought in more than two decades, relying on just-in-time rains and unseasonably cool temperatures that prevailed across the state until the arrival of last week’s sweltering heat.

At least a portion of Iowa has been categorized in some stage of drought for 160 consecutive weeks, setting a new record for the longest duration of drought since the U.S. Drought...