For all intents and purposes, the old Secretary of State (assuming he/she meets all the other requirements for the Presidency) is now President. If the House elects a new Speaker that afternoon, that new Speaker would only assume the office of the Presidency if any of the situations outlined in Amendment 25 come to pass. (The President: Dies, is otherwise incapacitated, steps down temporarily, resigns, etc.)
paperbackwriter’s answer is correct (with the one exception below). But you may be interested in the thread Presidential succession: The B List, which asks:
Oddly, the Presidential Succession Act (codified at 3 U.S.C. § 19) still does not include the Secretary of Homeland Security. The act establishing a new executive department customarily adds the department head to the line of succession at the end, so that (as Hadrian0117 notes) the line extends through “the cabinet secretaries according to when their Dept was created.” But the act establishing the Department of Homeland Security omitted such a provision – through oversight, I am told by a friend who worked in the Attorney General’s office at the time, but who knows. There was some draft legislation in 2002 or 2003 that would have added the Secretary of Homeland Security to the line of succession, but not at the end – following the Secretary of Defense, IIRC.
The Presidential Succession Act, originally enacted in 1792, has been amended three times. The Presidential Succession Act of 1792 listed the President pro tempore of the Senate, then the Speaker of the House, followed by a new midterm Presidential election. The Presidential Succession Act of 1886 eliminated the legislative successors, partly out of concern that they were not “officers” eligible for succession, in favor of the heads of the executive departments, in order of their establishment. The Presidential Succession Act of 1947, shepherded by President Harry S. Truman, inserted the Speaker of the House and the President pro tem of the Senate back into the line of succession, ahead of the executive-branch department heads. The 1947 Act is still the law today, although it has been amended whenever an executive department has been established (with the noteworthy exception of the Department of Homeland Security) or de-established (in the case of the Post Office Department).
There was never a time when the line of succession included “members of Congress according to seniority,” unless you count the fact that the President pro tem is customarily the most senior member of the Senate majority.
This provision relates only to the Speakership pro tempore. The Speaker pro tempore acts as speaker in the Speaker’s absence or when the Speakership is vacant, particularly for the purpose of presiding over the House of Representatives, but does not become the Speaker. When the House is sitting and the Speakership is not vacant, but the Speaker is merely absent, several representatives may serve as Speaker pro tempore in short order: the Speaker’s chair is taken by the highest-listed representative under House Rule I(b) who is present in the chamber, who must yield the chair whenever a higher-listed representative appears. A Speaker pro tempore cannot become a Presidential successor unless the House actually elects him or her as the Speaker.
The succession is not automatic, and a statutory successor can decline the succession. The Presidential Succession Act provides that a statutory successor assumes the Presidency only after resigning the office by virtue of which he or she succeeds:
A statutory successor can decline the succession by not resigning the office by virtue of which he or she could succeed. A brief stint as President may not be very appealing to a powerful Speaker or a very senior senator faced with the choice of abandoning a long and successful Congressional career in exchange for a few hours in the White House.
The line of succession has never included the Chief Justice, or any other judicial officer. Several proposals for such an extension have been floated over the years, but none has been enacted.
That’s why I wrote, “provided that he or she was qualified to be president (native born, at least 35 years old, etc.).” Among the qualifications for the presidency is not holding simultaneously another federal office.