Assuming it's an original Nintendo joystick, completely disassemble it and clean the ball and socket. The easiest way to do that is to submerge the base in a solvent and let it soak overnight (make sure it's just the base, which is all steel). The cheapest solvent you can get for that purpose is probably gasoline, which costs less for a gallon than most solvents cost for a pint or less. After it has soaked, use a toothbrush, Q-tips, pipe cleaners, or whatever, along with some more solvent (I'd use something that's also a degreaser like alcohol at this point, to get rid of the oily gasoline residue), to clean out that socket to the point that you could eat off of it. Once the ball and socket are truly clean, the joystick will operate slick as a smelt, even without lubrication.
For lubrication, I use 3M 08897 dry-type silicone spray. It doesn't harm plastics or rubber and its lubricating effect lasts for a long time. Also, because the carrier dries leaving behind the silicone lubricant, it isn't a dust/dirt magnet like wet lubricants are. Plus it has no viscosity. The viscosity of fluids such as oil, and especially grease, can make the joystick feel sluggish. Since there's practically zero load or sustained speed applied to the pivot ball during normal operation, grease is entirely unnecessary. It's not as if it's a wheel bearing in a car.
As a bonus, a spray can with a straw makes it very easy to re-lubricate it down the road without having to disassemble it again.