Aguja (Spanish for “needle”) and the similar Agujero (“hole”) both come from the Latin acus, also “needle.”
From the same Latin root, via Latin, we get the English acuity. Being sharp with your wit and observations is just another form of being sharp!
Another descendent (just slightly more distant!) is acrid — because that which is bitter is really sharp on the tongue.
The a-c root in English maps to the a-g root in Spanish. The c- and g- transformation is a very common one too; both sounds are very similar!