The differences between 反而 (fǎn'ér) and 相反 (xiāngfǎn) are pretty clear. 反而 is an adverb, while 相反 is an adjective and also a conjunction, and this determines how they are used grammatically.
相反 normally starts a sentence, and when used should be followed with a comma. As an adverb, 反而 is not so set apart from the rest of the sentence, and should not be followed by a comma.
A,相反,B
A,反而 B
反而 is used in the context of the speaker expecting some kind of turning point. 相反 is for similar things that have a different aspect. 反而 conveys that the difference between what was expected and what actually happened was quite large. 相反 isn't as strong.
Situation,相反,The Opposite of the Situation
Expectation,反而 + The Opposite of Expectation
相反 is an adjective, and of course it can also be an attribute. Just make sure to add a 的 after it. 反而 cannot be used this way.
相反 + 的 + Noun
相反, like all other adjectives, can be placed after the subject as the predicate of the sentence.
Subj. + 相反
A 和 / 跟 B + 是 + 相反的