The useful English idiom is to work like a charm, meaning “to work/operate perfectly” or “to have exactly the desired effect”.
Something can theoretically work as a charm: for example if you use “charm” in the meaning of “amulet”, you can say that “an emerald works as a charm” to express that an emerald can be used as a functioning amulet, but that’s not something you would usually want to say.