Understand [question-か] [quotative-と] ask-[when-と] he [topic-は] nodded.
Nested quotation: 分かりますか is the quoted question, marked by と, embedded inside a temporal clause with と (when). The inner と is quotative; the outer と is temporal — 'when I asked.' うなずく means to nod.