 Rafael was originally left out of the Brazil squad for their friendlies in May and June 2012, but was later called up to replace the injured Dani Alves.Porto right back Danilo was selected ahead of Rafael for the game against Denmark on 26 May, but he did eventually come on as a substitute to make his senior international debut.On 26 July 2012, Rafael scored Brazil under-23's first goal at the 2012 Olympics in a 3–2 victory over Egypt.