NGH said the power went off at around 11.30pm in parts of the site, while other areas were unaffected.
A spokeswoman for Northampton General Hospital (NGH) said this morning: "We had a generator fail in the early hours of the morning of Saturday, February 23 and whilst we were sorting out the issue we went on temporary divert to Milton Keynes and Kettering.
"The issue was resolved within a couple of hours and we came off divert about 5.30am on February 23.
Extra staff were drafted in to help including senior consultants, nurses and other on-call staff. A&E was also closed.
The hospital has confirmed that any obstetric patients requiring surgery were transferred to the main theatres, which were unaffected, as were ITU and HDU.
Back-up systems were used to provide power for equipment where needed.
The spokesman said: "All our systems are regularly checked, tested and monitored. It’s unusual for a generator to fail and first our priority was to maintain patient safety and minimise risk whilst the necessary investigatory work was undertaken to understand the reasons for the generator failure.
"Our staff worked tirelessly throughout the night to keep our patients safe and resolve the issues were experiencing with our generators."