Exhibit 23.1
Consent of Independent Registered Public Accounting Firm
We hereby consent to the incorporation by reference in the Registration Statement on Form S-8 (No. 333-139996, No. 033-55327 and No. 333-277593) of MasTec, Inc. of our report dated June 26, 2026, relating to the financial statements and supplemental schedules of The MasTec, Inc. 401(k) Retirement Plan which appear in this Form 11-K for the year ended December 31, 2025.
/s/ BDO USA, P.C.
Miami, Florida
June 26, 2026