Exhibit 23.1 CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM We consent to the incorporation by reference in Registration Statement No. 333-40472 of KeySpan Corporation on Form S-8 of our report dated June 29, 2005, appearing in this Annual Report on Form 11-K of the KeySpan Energy 401(k) Plan for Management Employees for the year ended December 31, 2004. /s/ Deloitte & Touche LLP - ------------------------- New York, New York June 29, 2005