Try accepting it.
You're really smart.
"Yes, I do have quite a bit of expertise about some things. Although, there are other areas in life where other people are quite a bit smarter than me." [Then, unless someone quickly steals the conversation away, immediately provide a clear example.]
A lot of people seem to think that you need to deny the compliment in order to not sound cocky. I don't think so. If people recognize a truth, it is acceptable to acknowledge truth.
If someone tries to give you a gift, whether it is in a box surrounded by wrapping paper or just a some kind words, does the giver hope that the receiver will reject the gift? Simply and genuinely accepting something nice that is offered, including a compliment, doesn't have to be a bad approach.
If someone compliments one of my strengths, of which I openly admit to having (including some notable ones), I've found people find me less arrogant when I demonstrate just how quickly I can counter by adding a recognition of where I lack, quite significantly inferior to even average abilities in some other area of life.
I just think about what I seem to fail at, or at least struggle with, where other people are easier? What are some tasks where I absolutely need to depend on other people who are more skilled in that area?
This usually goes well; people who give me compliments are able to have their compliments received. If someone is trying to check for clarity, they can have their ideas acknowledged and confirmed, without me needing to muddy the waters with words that imply I might not entirely agree with even as I say them. Yet, with a quick lesson in diversity, I point out how the strength is limited in some ways, and I introduce another aspect of my life, and the end result doesn't turn out to seem too haughty for most people's tastes.
When I've been successful, the concept of me seeming arrogant threatened my life quest of always being honest. The solution I've come up with is this surprisingly simple idea: When the truth seems like it might shine a nice light upon you, this approach of adding more truth lets you humbly manage to do what a person should always do with a correct compliment or any other form of truth: accept it.