Lisa Murkowski has been officially declared winner of the US Senate contest in Alaska, following a long legal challenge by rival Joe Miller.
Ms Murkowski lost the Republican nomination in August to Mr Miller, a candidate backed by the Tea Party.
But she ran a write-in campaign, asking her supporters to add her name to the ballot paper to vote for her.
She is the first Senate candidate to be elected in a write-in campaign since 1954.
State authorities said Ms Murkowski's margin of victory in the officially certified result was 10,252 votes.
Mr Miller had appealed after votes were hand-counted following the 2 November election.
He said ballots on which Ms Murkowski's name was not spelt correctly or the oval next to her name was not filled in, should not count.
A federal judge, Ralph Beistline, lifted his hold on the certification of the results after Alaska's Supreme Court upheld a lower court ruling that allowed misspellings.
Voter intent was "paramount", the state Supreme Court said.
The certification is expected to be hand-delivered to Washington, in order to avoid delays that could prevent Ms Murkowski being sworn in with other senators on Wednesday, the Associated Press news agency reported.
Mr Miller is expected to announce on Friday whether he will mount a further legal challenge over the election.
Analysts have described Ms Murkowski's victory as a rebuke for Ms Palin, the 2008 Republican vice-presidential candidate and Tea Party figurehead.
She has been openly at odds with Ms Murkowski since defeating her father Frank Murkowski to win Alaska's governorship in 2006.
The last US senator to win an election via a write-in was Strom Thurmond in the US Senate contest in South Carolina in 1954.