I was the only one who could answer that question correctly.
Literal
I [only-だけが] that question [to-に] correctly answer [thing-こと-が] could.
だけが ('only [X] is the one who') marks exclusive focus as the subject. 正しく is the く-form of 正しい ('correct') used adverbially. The pattern [verb dict-form]+ことができる is a formal/written way to express ability, equivalent to the potential form. 問題に答える ('to answer a question') takes に for what's answered.