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