The Beatles classic Yesterday was among the repertoire a Brazilian guitarist played for a select audience of doctors and nurses while they were performing brain surgery on him.

Doctors at the Nossa Senhora da Conceicao hospital in the southern Santa Catarina state needed Anthony Kulkamp Dias, 33, to remain conscious as they proceeded to remove a tumour, in order to better map his brain and avoid injuring tissue that could cause permanent damage.

Dias, a former professional musician for 20 years who recently turned banker, embraced his guitar and strummed a selection of Brazilian folk songs while lying on the operating table.

The exceptional performance was recorded on camera by hospital staff, led by neurosurgeon Marcos Ghizoni, and later posted on Facebook where it soon went viral.

"The doctors asked me to repeat a country song, so I even had an encore," Kulkamp told the Brazilian news outlet G1.

He played a total of six songs throughout the operation during which he had to stop and rest several times.

"My right hand was a bit weaker because that was the side that they were operating on," he told G1. "I was interspersing songs and talking."

The hospital said Dias's opening song was Emanuel, a piece he composed for his son born only a month prior to the surgery. The guitarist was diagnosed with brain tumour two weeks later.

Clinical director Jean Abreu Machado said usually this type of surgery is carried out with the patient under general anaesthetic, but the risk of harming vital areas of the brain is too high when the tumour is close to them.

"By keeping the patient awake during surgery, these areas can be monitored in real time," Machado said. "It really is a great challenge for the whole surgery team, including the anaesthetist."

Kulkamp said 90% of the tumour was successfully removed.