In book XXIII, Penelope recognises him:

"Penelope started down from her lofty room, her heart
in turmoil, torn ... should she keep her distance,
probe her husband? Or rush up to the man at once
and kiss his head and cling to both his hands?
As soon as she stepped across the stone threshold,
slipping in, she took a seat at the closest wall
and radiant in the firelight, faced Odysseus now.
There he sat, leaning against the great central column,
eyes fixed on the ground, waiting, poised for whatever words
his hardy wife might say when she caught sight of him.
A long while she sat in silence ... numbing wonder
filled her heart as her eyes explored his face.
One moment he seemed ... Odysseus, to the life—
the next, no, he was not the man she knew,
a huddled mass of rags was all she saw.
Come, Eurycleia,
move the sturdy bedstead out of our bridal chamber—
that room the master built with his own hands.
Take it out now, sturdy bed that it is,
and spread it deep with fleece,
blankets and lustrous throws to keep him warm.”
Putting her husband to the proof—but Odysseus
blazed up in fury, lashing out at his loyal wife:
“Woman—your words, they cut me to the core!
Who could move my bed? Impossible task,
even for some skilled craftsman—unless a god
came down in person, quick to lend a hand,
lifted it out with ease and moved it elsewhere.
Not a man on earth, not even at peak strength,
would find it easy to prise it up and shift it, no,
a great sign, a hallmark lies in its construction.
I know, I built it myself—no one else ...
There was a branching olive-tree inside our court,
grown to its full prime, the bole like a column, thickset.
Around it I built my bedroom, finished off the walls
with good tight stonework, roofed it over soundly
and added doors, hung well and snugly wedged.
Then I lopped the leafy crown of the olive,
clean-cutting the stump bare from roots up,
planing it round with a bronze smoothing-adze—
I had the skill—I shaped it plumb to the line to make
my bedpost, bored the holes it needed with an auger.
Penelope felt her knees go slack, her heart surrender,
recognizing the strong clear signs Odysseus offered.
She dissolved in tears, rushed to Odysseus, flung her arms
around his neck and kissed his head and cried out,
“Odysseus—don’t flare up at me now, not you,
always the most understanding man alive!
The gods, it was the gods who sent us sorrow—
they grudged us both a life in each other’s arms
from the heady zest of youth to the stoop of old age.
But don’t fault me, angry with me now because I failed,
at the first glimpse, to greet you, hold you, so ...
In my heart of hearts I always cringed with fear
some fraud might come, beguile me with his talk;
the world is full of the sort,
cunning ones who plot their own dark ends."