BIRMINGHAM, Ala. — Mitt Romney has tried for weeks to snuff out Newt Gingrich’s presidential ambitions, but his stubborn survival has become a welcome relief for Mr. Romney.

If Mr. Romney has a chance of winning the Alabama primary on Tuesday — his advisers believed the odds were strong enough to arrange a last-minute campaign visit on the eve of the election — it is largely because Mr. Gingrich’s candidacy remains alive.

The Romney campaign and its well-financed allies have invested tens of millions of dollars trying to crush Mr. Gingrich over the last two months. But Mr. Gingrich’s resilience has so far allowed Mr. Romney to dodge the head-to-head competition that Rick Santorum has been craving.