Well, if you just realized that your brain wasn't working properly, then yes. Your translation seems a perfect fit.
If it's been the case for a while now, then it's better to say:
мозги не работают - мозг не работает. And a bit of a idiomatic expression for you:
Голова (башка) не варит
Also you can replace мозги with голова or башка (a bit rude) in all examples above.