Many questions of the form "could Germany have done X in early WWII?" can be answered with some variation of "yes, if Hitler wasn't so obsessed with invading the Soviet Union". The other answer is "yes, if the Italian military didn't suck so bad". Mussolini was like Hitler's incompetent kid brother trying to imitate everything his big brother did and then crying for help when he found out war is really hard.
Hitler had always been obsessed with carving up the western Soviet Union and in December 1940 planning officially began for the invasion in the summer of 1941, Operation Barbarossa. This would be the largest invasion the world had ever seen stretching German resources and logistics to the limits. This drew not only Hitler's attention, but the army staff, and tremendous resources. In comparison, North Africa was a side show.
A general problem with the German strategy in North Africa was they didn't have one. The Italians did, but their reach far exceeded their grasp. The tactics of the Afrika Korps were brilliant, the German lack of commitment to the front was what undid them. The whole thing was a slap dash, reactionary affair to bolster Italian dreams of empire.
Had the Italians succeeded in invading Egypt, sending the DAK would have been unnecessary and Germany may have left North Africa and the Middle East to the Italians. Alternatively, Germany could have integrated North Africa into their invasion of the Soviet Union, taking the Soviets by the flank via the Middle East. This more considered approach likely would have won them the whole of the British African and Middle Eastern empire as the British were woefully unprepared. Malta would have been invaded, much as they invaded Crete, preventing British interdiction of German and Italian supplies. Spain would have been pressed more vigorously to intervene in Gibraltar. Once Gibraltar and the Suez Canal were taken, Britain would have to supply the Middle East the very long way around Africa. Turkey may have been pressured to allow German shipping through the Dardanelles Straits to supply their Soviet invasion via the Middle East.
Could the DAK have been activated sooner and with greater resources including more Luftwaffe support?
Yes, but they lacked a strategic reason (in Hitler's mind) to do so. The Italians seemed to be doing well early on.
Coinciding with the beginning of planning for Barbarossa was the beginning of the Italian rout in North Africa. A few months earlier the Italians seemed to be doing well in North Africa having successfully invaded Egypt, but then sort of milled around for a while giving the British ample time to build up reinforcements and counter attack. The subsequent Italian rout happened just as plans for Barbarossa was getting into full swing.
Having thought the Italians had the British well in hand, Hitler had to throw together the Afrika Korps piecemeal as a blocking force to help the Italians, not fully intending to take over the invasion. Rommel decided otherwise, but without strategic backing logistics would undo him.
Why not get the Spanish to capture Gibraltar?
As above, because Hitler didn't realize the strategic importance of North Africa, he thought the Italians had it covered, and because it wasn't in Spain's best interests to do so.
Immediately after the fall of France, many of Hitler's generals advised they dash through Spain whether Spain liked it or not, and take Gibraltar thus cutting off Britain from the Mediterranean and severely crippling their ability to fight in North Africa. Operation Felix was a German plan to invade Gibraltar via Spain whether Spain liked it or not. It was never carried out.
It seems the person sent to negotiate with Spain, Admiral Wilhelm Canaris did not like Hitler's Germany and fed information to Spain to discourage their joining the war. This led a canny Franco to make huge demands on Germany in return for joining the war or allowing safe passage, demands Hitler rejected.
For Spain's part, they had just ended a horrible civil war in 1939 and were a wreck. Newly minted Spanish dictator Francisco Franco would have guerrillas to contend with, an economy to rebuild, and political power to consolidate. Entering into a war of opportunity with Britain would not help. With all the foreign intervention in their civil war, the Spanish knew the destruction when your country becomes a battleground for larger powers and feared the British and Germans slugging it out on Spanish soil or invading Spanish colonies.
Were any political attempts made to get Turkey to join the war on the Axis side?
Both the Allies and the Axis courted having Turkey enter the war, but Turkey remained steadfastly neutral.
Turkey was stuck in a similar situation as Spain. Modern Turkey was born out of the ashes of World War I and the dismembering of the Ottoman Empire. The newly formed Republic Of Turkey resisted efforts by the allies (particularly the Greeks) to carve up the Anatolian Peninsula. They were focused on rebuilding, not of a war of opportunity. Stuck between the Germans, the British, the Greeks (British allies) and the Soviets, Turkey risked becoming a proxy battleground should they enter the war.
The Turks had closed access to the Dardanelles to the waring nations, something of a double edged sword for the Axis. It cut off an Allied supply route to the Soviet Union, and prevented the powerful, but very hard pressed, British Navy from intervening. However, the invasion of Crimea and Sebastopol could have been greatly helped by allowing the (on paper) powerful Italian Navy to support an amphibious landing and likely shortening the eight month slugging match.
In 1945, with the end of the war clearly in sight, Turkey declared war on Germany and Japan as a symbolic gesture.