similarly; in the same way; identically
Used to indicate that an action or state occurs in the same manner as something else. Often appears in formal or written contexts.
この問題は前回と同様に難しい。
This problem is similarly difficult as the last one.
彼は同様に驚いた表情を見せた。
He showed an equally surprised expression.
同様に explicitly states that something applies 'in the same way', while やはり's 'too/also' sense conveys this more casually, almost as an aside.
From 同様 (どうよう, 'same, identical') + adverbial suffix に.