He told the Welsh Parliament she felt pride at “your many great achievements” and also “felt you deeply in great times of sorrow”.
His address was in response to a Motion of Condolence in the Senedd, which came after the late monarch was described during a memorial service at Llandaff Cathedral in Cardiff earlier in the day as a “towering figure on the world stage”.
The King and the Queen Consort were greeted by gun salutes and cheering schoolchildren when they arrived in the Welsh capital – the final stop on their tour of the four home nations which began after the Queen’s death last Thursday.
In his address to the Senedd, which the former Prince of Wales partly delivered in Welsh, Charles said: “Through all the years of her reign, the land of Wales could not be closer to my mother’s heart.
“I know she took immense pride in your many great achievements, even as she also felt you deeply in great times of sorrow.
“It must surely be counted the greatest achievement to belong to a land that inspired so much devotion.
“I am resolved to honour that same example in the spirit of the words I always try to live my own life – Ich dien – I Serve.”
During their day in Cardiff the couple went on a number of walkabouts, shaking hands with members of the public and chatting to well-wishers.
Earlier, they attended a service of prayer and reflection for the life of the Queen at Llandaff Cathedral, where the congregation included Prime Minister Liz Truss, First Minister Mark Drakeford and Welsh Secretary Robert Buckland.
Archbishop of Wales Andy John said in his address: “Her ability to influence, to utilise soft power – no less significant, no less authoritative – illustrates the wise and careful thought she brought to her role.
“Prime ministers found that she was a trusted confidante. Her attention to matters of government, her knowledge of world events and the longevity of her reign gave her an unmatched perspective and ability to see the distant scene.”
He added: “We also saw a monarch who could surprise and delight us. We will never look at a jar of marmalade again in the same way, nor watch Mr Bond without remembering 2012 and that extraordinary leap into the void.
“Her late majesty was also a towering figure on the world stage, embodying a continuity and stability, but, perhaps more than that, values – values which are shared across nations and cultures.”
The Archbishop said of her ability to connect with people: “And in Wales, that skill was never more evident than when she visited Aberfan in 1966 – that community finding her presence deeply consoling – and Her Majesty would return four more times to that community.”